]> granicus.if.org Git - linux-pam/commitdiff
Relevant BUGIDs:
authorTomas Mraz <tm@t8m.info>
Thu, 4 Nov 2004 11:49:39 +0000 (11:49 +0000)
committerTomas Mraz <tm@t8m.info>
Thu, 4 Nov 2004 11:49:39 +0000 (11:49 +0000)
Purpose of commit:
bugfix
Commit summary:
---------------
Make limiting logins for users in a group actually work

modules/pam_limits/pam_limits.c

index 4354d3e1239ac959c14602eae3773089da9b4b5a..2e9314a88072005e4ea38cdf071b06592e8a53e9 100644 (file)
@@ -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);