diff options
-rw-r--r-- | compat/getgrouplist.c | 2 | ||||
-rw-r--r-- | plugins/group_file/group_file.c | 4 | ||||
-rw-r--r-- | plugins/system_group/system_group.c | 14 |
3 files changed, 11 insertions, 9 deletions
diff --git a/compat/getgrouplist.c b/compat/getgrouplist.c index 6e035be84..57582eaac 100644 --- a/compat/getgrouplist.c +++ b/compat/getgrouplist.c @@ -318,7 +318,7 @@ getgrouplist(const char *name, gid_t basegid, gid_t *groups, int *ngroupsp) setgrent(); while ((grp = getgrent()) != NULL) { - if (grp->gr_gid == basegid) + if (grp->gr_gid == basegid || grp->gr_mem == NULL) continue; for (i = 0; grp->gr_mem[i] != NULL; i++) { diff --git a/plugins/group_file/group_file.c b/plugins/group_file/group_file.c index 77d65b68d..0113d15f8 100644 --- a/plugins/group_file/group_file.c +++ b/plugins/group_file/group_file.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2013 Todd C. Miller <Todd.Miller@courtesan.com> + * Copyright (c) 2010-2014 Todd C. Miller <Todd.Miller@courtesan.com> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -121,7 +121,7 @@ sample_query(const char *user, const char *group, const struct passwd *pwd) char **member; grp = mygetgrnam(group); - if (grp != NULL) { + if (grp != NULL && grp->gr_mem != NULL) { for (member = grp->gr_mem; *member != NULL; member++) { if (strcasecmp(user, *member) == 0) return true; diff --git a/plugins/system_group/system_group.c b/plugins/system_group/system_group.c index 2d496dc4c..dc228c535 100644 --- a/plugins/system_group/system_group.c +++ b/plugins/system_group/system_group.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2013 Todd C. Miller <Todd.Miller@courtesan.com> + * Copyright (c) 2010-2014 Todd C. Miller <Todd.Miller@courtesan.com> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -140,11 +140,13 @@ sysgroup_query(const char *user, const char *group, const struct passwd *pwd) grp = sysgroup_getgrgid(gid); } if (grp != NULL) { - for (member = grp->gr_mem; *member != NULL; member++) { - if (strcasecmp(user, *member) == 0) { - if (sysgroup_gr_delref) - sysgroup_gr_delref(grp); - return true; + if (grp->gr_mem != NULL) { + for (member = grp->gr_mem; *member != NULL; member++) { + if (strcasecmp(user, *member) == 0) { + if (sysgroup_gr_delref) + sysgroup_gr_delref(grp); + return true; + } } } if (sysgroup_gr_delref) |