In my setup the apache user belogns to several groups more than 8 which is the edfault RUID_MAXGROUPS value.
So I get errors "getgroups() failed on child init, ignoring supplementary group IDs" and the process groups are not reset correctly. I could recompile with a higher RUID_MAXGROUPS value, but I prefered to try a simple patch which seems to work. Maybe it (or something like that) could be included?
--- mod_ruid2.c.orig 2013-03-19 21:42:00.000000000 +0100
+++ mod_ruid2.c 2014-01-24 17:40:05.181533124 +0100
@@ -107,7 +107,7 @@
static int coredump, root_handle;
static const char *old_root;
-static gid_t startup_groups[RUID_MAXGROUPS];
+static gid_t *startup_groups;
static int startup_groupsnr;
@@ -353,9 +353,15 @@
cap_value_t capval[4];
/* detect default supplementary group IDs */
- if ((startup_groupsnr = getgroups(RUID_MAXGROUPS, startup_groups)) == -1) {
+ if ((startup_groupsnr = getgroups(0, NULL)) == -1) {
startup_groupsnr = 0;
- ap_log_error (APLOG_MARK, APLOG_ERR, 0, NULL, "%s ERROR getgroups() failed on child init, ignoring supplementary group IDs", MODULE_NAME);
+ ap_log_error (APLOG_MARK, APLOG_ERR, 0, NULL, "%s ERROR getgroups(0, NULL) failed on child init, ignoring supplementary group IDs", MODULE_NAME);
+ } else {
+ startup_groups = apr_pcalloc(p, startup_groupsnr * sizeof(gid_t));
+ if (getgroups(startup_groupsnr, startup_groups) == -1) {
+ startup_groupsnr = 0;
+ ap_log_error (APLOG_MARK, APLOG_ERR, 0, NULL, "%s ERROR getgroups() failed on child init, ignoring supplementary group IDs", MODULE_NAME);
+ }
}
/* setup chroot jailbreak */
Hi all
In my setup the apache user belogns to several groups more than 8 which is the edfault RUID_MAXGROUPS value.
So I get errors "getgroups() failed on child init, ignoring supplementary group IDs" and the process groups are not reset correctly. I could recompile with a higher RUID_MAXGROUPS value, but I prefered to try a simple patch which seems to work. Maybe it (or something like that) could be included?
Thank you