From: Tomas Mraz Date: Thu, 4 Nov 2004 11:49:39 +0000 (+0000) Subject: Relevant BUGIDs: X-Git-Tag: Linux-PAM-0-78~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=03c0e333157fa290a8f94621b427e493778f5410;p=linux-pam Relevant BUGIDs: Purpose of commit: bugfix Commit summary: --------------- Make limiting logins for users in a group actually work --- diff --git a/modules/pam_limits/pam_limits.c b/modules/pam_limits/pam_limits.c index 4354d3e1..2e9314a8 100644 --- a/modules/pam_limits/pam_limits.c +++ b/modules/pam_limits/pam_limits.c @@ -76,6 +76,7 @@ struct pam_limit_s { struct user_limits_struct limits[RLIM_NLIMITS]; char conf_file[BUFSIZ]; int utmp_after_pam_call; + char login_group[LINE_LENGTH]; }; #define LIMIT_LOGIN RLIM_NLIMITS+1 @@ -203,7 +204,7 @@ check_logins (pam_handle_t *pamh, const char *name, int limit, int ctrl, continue; } if ((pl->login_limit_def == LIMITS_DEF_ALLGROUP) - && !_pammodutil_user_in_group_nam_nam(pamh, ut->UT_USER, name)) { + && !_pammodutil_user_in_group_nam_nam(pamh, ut->UT_USER, pl->login_group)) { continue; } } @@ -479,9 +480,11 @@ static int parse_config_file(pam_handle_t *pamh, const char *uname, int ctrl, if (strcmp(domain,"%") == 0) process_limit(LIMITS_DEF_ALL, ltype, item, value, ctrl, pl); - else if (_pammodutil_user_in_group_nam_nam(pamh, uname, domain+1)) + else if (_pammodutil_user_in_group_nam_nam(pamh, uname, domain+1)) { + strcpy(pl->login_group, domain+1); process_limit(LIMITS_DEF_ALLGROUP, ltype, item, value, ctrl, pl); + } } else if (strcmp(domain, "*") == 0) process_limit(LIMITS_DEF_DEFAULT, ltype, item, value, ctrl, pl);