Blame SOURCES/0001-The-scheduler-now-uses-the-getgrouplist-function-whe.patch

87cf9a
diff -up cups-1.6.3/config.h.in.getgrouplist cups-1.6.3/config.h.in
87cf9a
--- cups-1.6.3/config.h.in.getgrouplist	2019-02-06 17:51:23.338680247 +0100
87cf9a
+++ cups-1.6.3/config.h.in	2019-02-06 17:51:23.388679840 +0100
87cf9a
@@ -550,6 +550,13 @@
87cf9a
 
87cf9a
 
87cf9a
 /*
87cf9a
+ * Do we have the getgrouplist() function?
87cf9a
+ */
87cf9a
+
87cf9a
+#undef HAVE_GETGROUPLIST
87cf9a
+ 
87cf9a
+
87cf9a
+/*
87cf9a
  * Do we have OS X 10.4's mbr_XXX functions?
87cf9a
  */
87cf9a
 
87cf9a
diff -up cups-1.6.3/config-scripts/cups-common.m4.getgrouplist cups-1.6.3/config-scripts/cups-common.m4
87cf9a
--- cups-1.6.3/config-scripts/cups-common.m4.getgrouplist	2019-02-06 17:51:23.387679848 +0100
87cf9a
+++ cups-1.6.3/config-scripts/cups-common.m4	2019-02-06 17:52:42.256037532 +0100
87cf9a
@@ -202,6 +202,9 @@ AC_CHECK_FUNCS(sigaction)
87cf9a
 dnl Checks for wait functions.
87cf9a
 AC_CHECK_FUNCS(waitpid wait3)
87cf9a
 
87cf9a
+dnl Check for getgrouplist
87cf9a
+AC_CHECK_FUNCS(getgrouplist)
87cf9a
+
87cf9a
 dnl See if the tm structure has the tm_gmtoff member...
87cf9a
 AC_MSG_CHECKING(for tm_gmtoff member in tm structure)
87cf9a
 AC_TRY_COMPILE([#include <time.h>],[struct tm t;
87cf9a
diff -up cups-1.6.3/configure.getgrouplist cups-1.6.3/configure
87cf9a
--- cups-1.6.3/configure.getgrouplist	2013-07-11 23:13:11.000000000 +0200
87cf9a
+++ cups-1.6.3/configure	2019-02-06 17:51:23.391679815 +0100
87cf9a
@@ -5155,6 +5155,18 @@ fi
87cf9a
 done
87cf9a
 
87cf9a
 
87cf9a
+for ac_func in getgrouplist
87cf9a
+do :
87cf9a
+  ac_fn_c_check_func "$LINENO" "getgrouplist" "ac_cv_func_getgrouplist"
87cf9a
+if test "x$ac_cv_func_getgrouplist" = xyes; then :
87cf9a
+  cat >>confdefs.h <<_ACEOF
87cf9a
+#define HAVE_GETGROUPLIST 1
87cf9a
+_ACEOF
87cf9a
+
87cf9a
+fi
87cf9a
+done
87cf9a
+
87cf9a
+
87cf9a
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tm_gmtoff member in tm structure" >&5
87cf9a
 $as_echo_n "checking for tm_gmtoff member in tm structure... " >&6; }
87cf9a
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
87cf9a
diff -up cups-1.6.3/scheduler/auth.c.getgrouplist cups-1.6.3/scheduler/auth.c
87cf9a
--- cups-1.6.3/scheduler/auth.c.getgrouplist	2019-02-06 17:51:23.003682975 +0100
87cf9a
+++ cups-1.6.3/scheduler/auth.c	2019-02-06 17:51:23.391679815 +0100
87cf9a
@@ -1489,6 +1489,21 @@ cupsdCheckGroup(
87cf9a
     * Group exists, check it...
87cf9a
     */
87cf9a
 
87cf9a
+#ifdef HAVE_GETGROUPLIST
87cf9a
+    if (user)
87cf9a
+    {
87cf9a
+      int	ngroups;		/* Number of groups */
87cf9a
+      gid_t	groups[2048];		/* Groups that user belongs to */
87cf9a
+
87cf9a
+      ngroups = (int)(sizeof(groups) / sizeof(groups[0]));
87cf9a
+      getgrouplist(username, user->pw_gid, groups, &ngroups);
87cf9a
+
87cf9a
+      for (i = 0; i < ngroups; i ++)
87cf9a
+        if (group->gr_gid == groups[i])
87cf9a
+	  return (1);
87cf9a
+    }
87cf9a
+#endif /* HAVE_GETGROUPLIST */
87cf9a
+
87cf9a
     for (i = 0; group->gr_mem[i]; i ++)
87cf9a
       if (!_cups_strcasecmp(username, group->gr_mem[i]))
87cf9a
 	return (1);
87cf9a
diff -up cups-1.6.3/vcnet/config.h.getgrouplist cups-1.6.3/vcnet/config.h
87cf9a
--- cups-1.6.3/vcnet/config.h.getgrouplist	2013-06-07 03:12:52.000000000 +0200
87cf9a
+++ cups-1.6.3/vcnet/config.h	2019-02-06 17:51:23.392679807 +0100
87cf9a
@@ -599,6 +599,13 @@
87cf9a
 
87cf9a
 
87cf9a
 /*
87cf9a
+ * Do we have the getgrouplist() function?
87cf9a
+ */
87cf9a
+
87cf9a
+#undef HAVE_GETGROUPLIST
87cf9a
+
87cf9a
+
87cf9a
+/*
87cf9a
  * Do we have OS X 10.4's mbr_XXX functions?
87cf9a
  */
87cf9a
 
87cf9a
diff -up cups-1.6.3/xcode/config.h.getgrouplist cups-1.6.3/xcode/config.h
87cf9a
--- cups-1.6.3/xcode/config.h.getgrouplist	2019-02-06 17:51:23.392679807 +0100
87cf9a
+++ cups-1.6.3/xcode/config.h	2019-02-06 17:53:54.616448200 +0100
87cf9a
@@ -536,6 +536,13 @@
87cf9a
 
87cf9a
 
87cf9a
 /*
87cf9a
+ * Do we have the getgrouplist() function?
87cf9a
+ */
87cf9a
+
87cf9a
+#define HAVE_GETGROUPLIST 1
87cf9a
+ 
87cf9a
+
87cf9a
+/*
87cf9a
  * Do we have OS X 10.4's mbr_XXX functions?
87cf9a
  */
87cf9a