deal with NULL gr_mem here too

This commit is contained in:
Todd C. Miller
2014-05-06 19:32:34 -06:00
parent e54fe5a269
commit 17cbfea8b7
3 changed files with 11 additions and 9 deletions

View File

@@ -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)