···11+Compatibility patch for Illumos/Solaris and possibly other platforms.
22+Implements getgrouplist when not provided by OS.
33+Without it, only the user's primary group is used in authentication!
44+--- 1970-01-01 00:00:00.000000000 +0000
55++++ dbus-1.6.8/dbus/getgrouplist.c 2013-02-28 13:10:51.081792722 +0000
66+@@ -0,0 +1,89 @@
77++/* $OpenBSD: getgrouplist.c,v 1.12 2005/08/08 08:05:34 espie Exp $ */
88++/*
99++ * Copyright (c) 1991, 1993
1010++ * The Regents of the University of California. All rights reserved.
1111++ *
1212++ * Redistribution and use in source and binary forms, with or without
1313++ * modification, are permitted provided that the following conditions
1414++ * are met:
1515++ * 1. Redistributions of source code must retain the above copyright
1616++ * notice, this list of conditions and the following disclaimer.
1717++ * 2. Redistributions in binary form must reproduce the above copyright
1818++ * notice, this list of conditions and the following disclaimer in the
1919++ * documentation and/or other materials provided with the distribution.
2020++ * 3. Neither the name of the University nor the names of its contributors
2121++ * may be used to endorse or promote products derived from this software
2222++ * without specific prior written permission.
2323++ *
2424++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2525++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2626++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2727++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2828++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2929++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3030++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3131++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3232++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3333++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3434++ * SUCH DAMAGE.
3535++ */
3636++
3737++/* OPENBSD ORIGINAL: lib/libc/gen/getgrouplist.c */
3838++
3939++/*
4040++ * get credential
4141++ */
4242++#include <sys/types.h>
4343++#include <string.h>
4444++#include <unistd.h>
4545++#include <grp.h>
4646++
4747++int
4848++getgrouplist(const char *uname, gid_t agroup, gid_t *groups, int *grpcnt)
4949++{
5050++ struct group *grp;
5151++ int i, ngroups;
5252++ int ret, maxgroups;
5353++ int bail;
5454++
5555++ ret = 0;
5656++ ngroups = 0;
5757++ maxgroups = *grpcnt;
5858++
5959++ /*
6060++ * install primary group
6161++ */
6262++ if (ngroups >= maxgroups) {
6363++ *grpcnt = ngroups;
6464++ return (-1);
6565++ }
6666++ groups[ngroups++] = agroup;
6767++
6868++ /*
6969++ * Scan the group file to find additional groups.
7070++ */
7171++ setgrent();
7272++ while ((grp = getgrent())) {
7373++ if (grp->gr_gid == agroup)
7474++ continue;
7575++ for (bail = 0, i = 0; bail == 0 && i < ngroups; i++)
7676++ if (groups[i] == grp->gr_gid)
7777++ bail = 1;
7878++ if (bail)
7979++ continue;
8080++ for (i = 0; grp->gr_mem[i]; i++) {
8181++ if (!strcmp(grp->gr_mem[i], uname)) {
8282++ if (ngroups >= maxgroups) {
8383++ ret = -1;
8484++ goto out;
8585++ }
8686++ groups[ngroups++] = grp->gr_gid;
8787++ break;
8888++ }
8989++ }
9090++ }
9191++out:
9292++ endgrent();
9393++ *grpcnt = ngroups;
9494++ return (ret);
9595++}
9696+--- dbus-1.6.8/dbus/dbus-sysdeps-unix.c.orig 2013-02-28 13:08:52.171215237 +0000
9797++++ dbus-1.6.8/dbus/dbus-sysdeps-unix.c 2013-02-28 13:13:52.224615146 +0000
9898+@@ -21,6 +21,10 @@
9999+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
100100+ *
101101+ */
102102++#ifndef HAVE_GETGROUPLIST
103103++#include "getgrouplist.c"
104104++#define HAVE_GETGROUPLIST
105105++#endif
106106+107107+ #include <config.h>
108108+