]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
The scheduler now uses the getgrouplist function when available (Issue #4611)
authorMichael Sweet <michael.r.sweet@gmail.com>
Fri, 13 May 2016 16:11:52 +0000 (12:11 -0400)
committerMichael Sweet <michael.r.sweet@gmail.com>
Fri, 13 May 2016 16:11:52 +0000 (12:11 -0400)
CHANGES.txt
config-scripts/cups-common.m4
config.h.in
configure
scheduler/auth.c
vcnet/config.h
xcode/config.h

index ec7b8aead4887502989d50775a457456556c1d38..25c7dabd177cb26561d7cce9850afd8001e27342 100644 (file)
@@ -1,8 +1,10 @@
-CHANGES.txt - 2.2b1 - 2016-05-11
+CHANGES.txt - 2.2b1 - 2016-05-13
 --------------------------------
 
 CHANGES IN CUPS V2.2b1
 
+       - The scheduler now uses the getgrouplist function when available
+         (Issue #4611)
        - The IPP backend no longer enables compression by default except for
          certain raster formats that generally benefit from it
          (<rdar://problem/25166952>)
index 3a912478c9477517ea5d5074ac84b93529eb33be..fbba71503a8fc451b079f7f078298c176c5e23da 100644 (file)
@@ -199,6 +199,9 @@ AC_CHECK_FUNCS(waitpid wait3)
 dnl Check for posix_spawn
 AC_CHECK_FUNCS(posix_spawn)
 
+dnl Check for getgrouplist
+AC_CHECK_FUNCS(getgrouplist)
+
 dnl See if the tm structure has the tm_gmtoff member...
 AC_MSG_CHECKING(for tm_gmtoff member in tm structure)
 AC_TRY_COMPILE([#include <time.h>],[struct tm t;
index e242d561185169b2e802bda50a2b7e96936157da..37cfc4cd1543f6320a204664ec32885e06eee7d0 100644 (file)
 #undef HAVE_SCDYNAMICSTORECOPYCOMPUTERNAME
 
 
+/*
+ * Do we have the getgrouplist() function?
+ */
+
+#undef HAVE_GETGROUPLIST
+
 /*
  * Do we have OS X 10.4's mbr_XXX functions?
  */
index c3af70dd1c2f525b7daa71222865a2e175eb98f9..38b2e9eb962a1b539989f67d3534f6f8765d5a4b 100755 (executable)
--- a/configure
+++ b/configure
@@ -5307,6 +5307,18 @@ fi
 done
 
 
+for ac_func in getgrouplist
+do :
+  ac_fn_c_check_func "$LINENO" "getgrouplist" "ac_cv_func_getgrouplist"
+if test "x$ac_cv_func_getgrouplist" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_GETGROUPLIST 1
+_ACEOF
+
+fi
+done
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tm_gmtoff member in tm structure" >&5
 $as_echo_n "checking for tm_gmtoff member in tm structure... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
index 4a0ece175b17eb70c575a2ae88a8a4a518eadf32..9ffc06a5b573876ec7d501fcb0539474873625fd 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Authorization routines for the CUPS scheduler.
  *
- * Copyright 2007-2015 by Apple Inc.
+ * Copyright 2007-2016 by Apple Inc.
  * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  * This file contains Kerberos support code, copyright 2006 by
@@ -1176,6 +1176,21 @@ cupsdCheckGroup(
     * Group exists, check it...
     */
 
+#ifdef HAVE_GETGROUPLIST
+    if (user)
+    {
+      int      ngroups,                /* Number of groups */
+               groups[2048];           /* Groups that user belongs to */
+
+      ngroups = (int)(sizeof(groups) / sizeof(groups[0]));
+      getgrouplist(username, (int)user->pw_gid, groups, &ngroups);
+
+      for (i = 0; i < ngroups; i ++)
+        if ((int)group->gr_gid == groups[i])
+         return (1);
+    }
+#endif /* HAVE_GETGROUPLIST */
+
     for (i = 0; group->gr_mem[i]; i ++)
       if (!_cups_strcasecmp(username, group->gr_mem[i]))
        return (1);
index e8e73f6b13acf149398042b854dc3e8f2c4e7161..fdbfd68e45884b08034bfd6556e3cbbf878bcc35 100644 (file)
@@ -585,6 +585,13 @@ typedef unsigned long useconds_t;
 /* #undef HAVE_SCDYNAMICSTORECOPYCOMPUTERNAME */
 
 
+/*
+ * Do we have the getgrouplist() function?
+ */
+
+#undef HAVE_GETGROUPLIST
+
+
 /*
  * Do we have OS X 10.4's mbr_XXX functions?
  */
index e16c6667cbaa50488f07e09f363528926a79b041..98aa98749a1d501e1f08a00f83ab2c52ebb9231e 100644 (file)
 #endif /* !TARGET_OS_IOS */
 
 
+/*
+ * Do we have the getgrouplist() function?
+ */
+
+#define HAVE_GETGROUPLIST 1
+
 /*
  * Do we have OS X 10.4's mbr_XXX functions?
  */