#1051181 FTBFS: can't build package when user has more than 16 supplementary groups

Package:
fapolicyd
Source:
fapolicyd
Description:
File Access Policy Daemon
Submitter:
Russell Coker
Date:
2023-11-06 00:39:03 UTC
Severity:
normal
Tags:
#1051181#5
Date:
2023-09-04 03:17:30 UTC
From:
To:
# TOTAL: 2
# PASS:  1
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

FAIL: gid_proc_test
===================

./gid_proc_test: Too many groups
FAIL gid_proc_test (exit status: 1)

Above are the relevant parts of the compile output when trying to build it by a
user with more than 16 supplementary groups.

Below is the patch to fix this:


Index: fapolicyd-1.1.7/src/tests/gid_proc_test.c
===================================================================
--- fapolicyd-1.1.7.orig/src/tests/gid_proc_test.c
+++ fapolicyd-1.1.7/src/tests/gid_proc_test.c
@@ -2,6 +2,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <grp.h>
+#include <limits.h>
 #include <error.h>
 #include "attr-sets.h"
 #include "process.h"
@@ -9,7 +10,7 @@
 int main(void)
 {
 	int res, num, i, check_intersect = 0;
-	gid_t gid, gids[16];
+	gid_t gid, gids[NGROUPS_MAX];
 	attr_sets_entry_t *groups = get_gid_set_from_pid(getpid());

 	gid = getgid();
@@ -17,7 +18,7 @@ int main(void)
 	if (!res)
 		error(1, 0, "Group %d not found", gid);

-	num = getgroups(16, gids);
+	num = getgroups(NGROUPS_MAX, gids);
 	if (num < 0)
 		error(1, 0, "Too many groups");

#1051181#10
Date:
2023-09-04 03:39:20 UTC
From:
To:
# id test
uid=1001(test) gid=1001(test) groups=1001(test),1003(zzzz),1004(zzz2),
1005(test2),1006(test6),1007(test7),1008(test8),1009(test9),1010(test10),
1011(test11),1012(test12),1013(test13),1014(test14),1015(test15),1016(test16),
1017(test17),1018(test18),1019(test19)

The above is the test user I used for compiling.  The real use case was a user
in a corporate network with 30+ groups from Active Directory.  This sort of AD
configuration is increasingly common and should work.

#1051181#17
Date:
2023-11-06 00:34:08 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
fapolicyd, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1051181@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Nobuhiro Iwamatsu <iwamatsu@debian.org> (supplier of updated fapolicyd package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Mon, 06 Nov 2023 09:16:04 +0900
Source: fapolicyd
Architecture: source
Version: 1.3.2-1
Distribution: unstable
Urgency: medium
Maintainer: Nobuhiro Iwamatsu <iwamatsu@debian.org>
Changed-By: Nobuhiro Iwamatsu <iwamatsu@debian.org>
Closes: 1051181
Changes:
 fapolicyd (1.3.2-1) unstable; urgency=medium
 .
   * Update to 1.3.2.
   * Fix FTBFS when user has more than 16 supplementary groups (Closes: #1051181)
     Add d/debian/patches/0008-Fix-FTBFS-cant-build-package-when-user.patch.
     Thank to Russell Coker <russell@coker.com.au>.
   * Drop rpmdb drom trust variable from fapolicyd.conf.
     + Add d/patches/0009-fapolicyd.conf-Drop-rpmdb-from-trust-variable.patch.
   * d/patches: Remove unnecessary patches.
   * Refresh d/patches/0007-Install-service-file-to-usr-lib-systemd.patch
   * Add support deb package.
     + d/rules: Set --with-deb to configure.
     + d/control: Add dpkg-dev to Build-Depends.
   * Fix build issue by libmd linkng.
     Add d/patches/0010-configure.ac-Swap-checkong-libmd-and-libdpkg.patch.
   * d/rules: Do not copy 90-deny-execute.rules to /etc/fapolicyd/rules.d.
   * d/rules: Disable start fapolicyd.service.
   * d/README.Debian: Update.
   * d/patches: Add 0011-Fix-section-number-of-man-files.patch.
Checksums-Sha1:
 67e1b2ff42d42905d1844b5e02c4f536f788170d 2051 fapolicyd_1.3.2-1.dsc
 99dbe618f33bdb7671823d388453daa5d8cd61fb 135755 fapolicyd_1.3.2.orig.tar.gz
 9a27088ae4388568a23a594e13ea448b5057686d 7056 fapolicyd_1.3.2-1.debian.tar.xz
 78e5c19b28508fff1cea21ab9375d69f240c2885 6431 fapolicyd_1.3.2-1_amd64.buildinfo
Checksums-Sha256:
 8c8dfbd6195616b1982a617c3019f9050a275b82f5baf4d6170eb3afe050a82d 2051 fapolicyd_1.3.2-1.dsc
 c32362066391ec2731f33cb09a44b547b792b4d2c20973a5b3575e9be6f1abb0 135755 fapolicyd_1.3.2.orig.tar.gz
 e7a3697cf2c6388f9223a839a4e2f24e5ea7bcc3b22640893cc1ee8ac7c7d4b0 7056 fapolicyd_1.3.2-1.debian.tar.xz
 316e0e8130e7ad3efbd7622a72627f62eb1a8d839d797804227b7224a14838cf 6431 fapolicyd_1.3.2-1_amd64.buildinfo
Files:
 2b0c63016a9878270c5fef9cf39be24e 2051 utils optional fapolicyd_1.3.2-1.dsc
 25db7875137f45967db5f3888e1ae040 135755 utils optional fapolicyd_1.3.2.orig.tar.gz
 5fef8680163b7305f7a1475c6eb65372 7056 utils optional fapolicyd_1.3.2-1.debian.tar.xz
 041f05264e173db691e5a01a1353b8d9 6431 utils optional fapolicyd_1.3.2-1_amd64.buildinfo
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEXmKe5SMhlzV7hM9DMiR/u0CtH6YFAmVIMHoACgkQMiR/u0Ct
H6bHgw/+I1LQnVE+yHPqV5GLo5V1Sios48s6ZyrIfhdO2ZjjRCOO88jxkDOif+H3
8W3RySfh5dQZS69BaKxJ1JcFGj5Kn/kP0gpf33aYsR6VW8zmYDQz/DQ7Px1udMmi
GpYjvApRyogsYiK80y0P8MVbyV2dpZboJi3Nu/0qK0w2HH5nlFBnavXbNYdJf4VC
8Nc9VIXuAey/DZaMMR4/8665i7SGWR6o25iu2InOkpmtP/R0ApguucnGzmGmutVS
lsbIuZFWdMLXRCd8NYgxpQfkeW35B+UE+U7pVsGlRVIpbmVG3WD3ISQeUpE7DmVL
xf9hGxB6OjUnF5EyN/swhqb20xZpIh/HEla62LCWXBBLxovrsvhc/K6sJcQhRFS5
0ISRFo51ehK7VYFl6xd3U4Ur+Qsx3zjKqkTS+f2BqhJQNqE+XDSI1beJAUgaEzWY
kqoZOzJcGCjC03wcEZLo+/lBsMeGRG4zdMTmYMu3Y88tzETu6dK9snX7CX72VosF
UKwgHdCQyEkpMT7gwu/eXQK8gvZ8bTVljSWWNGLq5kaTDLanTbAAHoiIcmekKQqT
GWbHosLBVbf74QuwOUBtxvj+DnQ+51slXez1nsnMwuvwXhdQVLxEh1CCEqs1v4XA
CvVxjTpz/tqaZOfrpw7xOlNAdJAhBB7EMFZj685Omt+XEjV+PuU=
=83bQ
-----END PGP SIGNATURE-----