]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/auth.c
Always check the group membership list (Issue #5613)
[thirdparty/cups.git] / scheduler / auth.c
index c910c131d4f446580e597c840e705f453d2bce1f..5bb80edc942863f099f6fcf2a27960bed19d3690 100644 (file)
@@ -1166,7 +1166,23 @@ cupsdCheckGroup(
 
     groupid = group->gr_gid;
 
+    for (i = 0; group->gr_mem[i]; i ++)
+    {
+     /*
+      * User appears in the group membership...
+      */
+
+      if (!_cups_strcasecmp(username, group->gr_mem[i]))
+       return (1);
+    }
+
 #ifdef HAVE_GETGROUPLIST
+   /*
+    * If the user isn't in the group membership list, try the results from
+    * getgrouplist() which is supposed to return the full list of groups a user
+    * belongs to...
+    */
+
     if (user)
     {
       int      ngroups;                /* Number of groups */
@@ -1187,13 +1203,6 @@ cupsdCheckGroup(
         if ((int)groupid == (int)groups[i])
          return (1);
     }
-
-#else
-    for (i = 0; group->gr_mem[i]; i ++)
-    {
-      if (!_cups_strcasecmp(username, group->gr_mem[i]))
-       return (1);
-    }
 #endif /* HAVE_GETGROUPLIST */
   }
   else