diff -Nuar cups-1.3.8.orig/scheduler/auth.c cups-1.3.8/scheduler/auth.c --- cups-1.3.8.orig/scheduler/auth.c 2008-04-21 18:13:22.000000000 -0500 +++ cups-1.3.8/scheduler/auth.c 2008-10-08 16:23:32.000000000 -0500 @@ -1281,6 +1281,7 @@ const char *groupname) /* I - Group name */ { int i; /* Looping var */ + int foundit; /* Whether or not the search returned a positive result. */ struct group *group; /* System group info */ char junk[33]; /* MD5 password (not used) */ #ifdef HAVE_MBR_UID_TO_UUID @@ -1302,29 +1303,43 @@ return (0); /* - * Check to see if the user is a member of the named group... + * Iterate through all group entries until a match is found. */ - - group = getgrnam(groupname); - endgrent(); - - if (group != NULL) + setgrent(); + foundit=0; + while(!foundit && (group=getgrent())!=NULL) { /* - * Group exists, check it... + * If the group name doesn't match, move on... */ + if(strcasecmp(groupname, group->gr_name)) + continue; + /* + * First, check to see if group ID matches the user's group ID. + */ + if(user && group->gr_gid == user->pw_gid) + { + foundit=1; + break; + } + + /* + * Check to see if the user is listed as a member of the group... + */ for (i = 0; group->gr_mem[i]; i ++) if (!strcasecmp(username, group->gr_mem[i])) - return (1); + { + foundit=1; + break; + } } + endgrent(); /* - * Group doesn't exist or user not in group list, check the group ID - * against the user's group ID... + * If the group membership was confirmed, return. */ - - if (user && group && group->gr_gid == user->pw_gid) + if(foundit) return (1); #ifdef HAVE_MBR_UID_TO_UUID