]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Always check the group membership list (Issue #5613)
authorMichael R Sweet <michael.r.sweet@gmail.com>
Tue, 16 Jul 2019 13:17:04 +0000 (09:17 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Tue, 16 Jul 2019 13:17:04 +0000 (09:17 -0400)
CHANGES.md
scheduler/auth.c

index a8af8ce38b0d8c5a91171f03c8f3ef2b21d9e148..3daf60e29e4a07d99c83bd63b3de55422fa444a7 100644 (file)
@@ -22,6 +22,9 @@ Changes in CUPS v2.2.12
 - Fixed some compatibility issues with old releases of CUPS (Issue #5587)
 - Fixed a bug in the scheduler job cleanup code (Issue #5588)
 - "make" failed with GZIP options (Issue #5595)
+- The scheduler now uses both the group's membership list as well as the
+  various OS-specific membership functions to determine whether a user belongs
+  to a named group (Issue #5613)
 - The scheduler would restart continuously when idle and printers were not
   shared (rdar://52561199)
 - Fixed a command ordering issue in the Zebra ZPL driver.
index fa4e2715de3415993b68f1fc7d0407b9792d849f..1fb3ffcc0bf28a48f8addb8b7ba1f3e3a3b1908e 100644 (file)
@@ -1176,7 +1176,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 */
@@ -1197,13 +1213,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