Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1Compatibility patch for Illumos/Solaris and possibly other platforms. 2Implements getgrouplist when not provided by OS. 3Without it, only the user's primary group is used in authentication! 4--- 1970-01-01 00:00:00.000000000 +0000 5+++ dbus-1.6.8/dbus/getgrouplist.c 2013-02-28 13:10:51.081792722 +0000 6@@ -0,0 +1,89 @@ 7+/* $OpenBSD: getgrouplist.c,v 1.12 2005/08/08 08:05:34 espie Exp $ */ 8+/* 9+ * Copyright (c) 1991, 1993 10+ * The Regents of the University of California. All rights reserved. 11+ * 12+ * Redistribution and use in source and binary forms, with or without 13+ * modification, are permitted provided that the following conditions 14+ * are met: 15+ * 1. Redistributions of source code must retain the above copyright 16+ * notice, this list of conditions and the following disclaimer. 17+ * 2. Redistributions in binary form must reproduce the above copyright 18+ * notice, this list of conditions and the following disclaimer in the 19+ * documentation and/or other materials provided with the distribution. 20+ * 3. Neither the name of the University nor the names of its contributors 21+ * may be used to endorse or promote products derived from this software 22+ * without specific prior written permission. 23+ * 24+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34+ * SUCH DAMAGE. 35+ */ 36+ 37+/* OPENBSD ORIGINAL: lib/libc/gen/getgrouplist.c */ 38+ 39+/* 40+ * get credential 41+ */ 42+#include <sys/types.h> 43+#include <string.h> 44+#include <unistd.h> 45+#include <grp.h> 46+ 47+int 48+getgrouplist(const char *uname, gid_t agroup, gid_t *groups, int *grpcnt) 49+{ 50+ struct group *grp; 51+ int i, ngroups; 52+ int ret, maxgroups; 53+ int bail; 54+ 55+ ret = 0; 56+ ngroups = 0; 57+ maxgroups = *grpcnt; 58+ 59+ /* 60+ * install primary group 61+ */ 62+ if (ngroups >= maxgroups) { 63+ *grpcnt = ngroups; 64+ return (-1); 65+ } 66+ groups[ngroups++] = agroup; 67+ 68+ /* 69+ * Scan the group file to find additional groups. 70+ */ 71+ setgrent(); 72+ while ((grp = getgrent())) { 73+ if (grp->gr_gid == agroup) 74+ continue; 75+ for (bail = 0, i = 0; bail == 0 && i < ngroups; i++) 76+ if (groups[i] == grp->gr_gid) 77+ bail = 1; 78+ if (bail) 79+ continue; 80+ for (i = 0; grp->gr_mem[i]; i++) { 81+ if (!strcmp(grp->gr_mem[i], uname)) { 82+ if (ngroups >= maxgroups) { 83+ ret = -1; 84+ goto out; 85+ } 86+ groups[ngroups++] = grp->gr_gid; 87+ break; 88+ } 89+ } 90+ } 91+out: 92+ endgrent(); 93+ *grpcnt = ngroups; 94+ return (ret); 95+} 96--- dbus-1.6.8/dbus/dbus-sysdeps-unix.c.orig 2013-02-28 13:08:52.171215237 +0000 97+++ dbus-1.6.8/dbus/dbus-sysdeps-unix.c 2013-02-28 13:13:52.224615146 +0000 98@@ -21,6 +21,10 @@ 99 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 100 * 101 */ 102+#ifndef HAVE_GETGROUPLIST 103+#include "getgrouplist.c" 104+#define HAVE_GETGROUPLIST 105+#endif 106 107 #include <config.h> 108