/*
* 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
* 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);