diff options
Diffstat (limited to 'lib/libpam/modules/pam_group')
-rw-r--r-- | lib/libpam/modules/pam_group/pam_group.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/libpam/modules/pam_group/pam_group.c b/lib/libpam/modules/pam_group/pam_group.c index a6e32cd..5b918c0 100644 --- a/lib/libpam/modules/pam_group/pam_group.c +++ b/lib/libpam/modules/pam_group/pam_group.c @@ -96,14 +96,12 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags __unused, if ((grp = getgrnam(group)) == NULL || grp->gr_mem == NULL) goto failed; - /* check if the group is empty */ - if (*grp->gr_mem == NULL) - goto failed; - - /* check membership */ + /* check if user's own primary group */ if (pwd->pw_gid == grp->gr_gid) goto found; - for (list = grp->gr_mem; *list != NULL; ++list) + + /* iterate over members */ + for (list = grp->gr_mem; list != NULL && *list != NULL; ++list) if (strcmp(*list, pwd->pw_name) == 0) goto found; |