make pam_csc not explode when the syscom group does not exist

This commit is contained in:
Jeremy Roman 2013-09-07 14:07:46 -04:00
parent 0ae69c11b0
commit 146946c36c
1 changed files with 1 additions and 3 deletions

View File

@ -199,14 +199,12 @@ PAM_EXTERN int pam_sm_acct_mgmt(pam_handle_t* pamh, int flags, int argc, const c
} }
/* check to see if user is in group syscom, if yes, still print message but allow login even if user expired */ /* check to see if user is in group syscom, if yes, still print message but allow login even if user expired */
i = 0;
grp = getgrnam("syscom"); grp = getgrnam("syscom");
while(grp->gr_mem[i] != NULL) { for(i = 0; grp && grp->gr_mem[i]; i++) {
if(!strcmp(grp->gr_mem[i], username)) { if(!strcmp(grp->gr_mem[i], username)) {
syscom = 1; syscom = 1;
break; break;
} }
i++;
} }
/* check username */ /* check username */