[Pkg-shadow-devel] [PATCH] libmisc/addgrps.c: ngroups allocator fix
Cal Peake
cp at absolutedigital.net
Thu May 5 19:56:03 UTC 2011
Hi,
The memory allocator loop in function add_groups needs an extra check,
otherwise it'll never actually try to allocate for more than 16 groups.
A compile and run-time tested patch is below.
Notably, this quells the "Warning: add_groups: Invalid argument" message
that Slackware (and presumably other non-PAM Linux) users get when logging
in while also being a member of more than 16 groups.
Thanks and kind regards,
--
Cal Peake
--- ./libmisc/addgrps.c~ 2011-02-13 12:58:11.000000000 -0500
+++ ./libmisc/addgrps.c 2011-05-05 14:53:38.000000000 -0400
@@ -71,7 +71,7 @@
return -1;
}
ngroups = getgroups (i, grouplist);
- if ((-1 == ngroups) || (i > (size_t)ngroups)) {
+ if ((-1 == ngroups && EINVAL != errno) || (i > (size_t)ngroups)) {
break;
}
/* not enough room, so try allocating a larger buffer */
More information about the Pkg-shadow-devel
mailing list