diff options
author | James Peach <jpeach@samba.org> | 2007-06-13 20:40:50 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:23:18 -0500 |
commit | 07f562be7a64a2ded7ec0e6f5910447dc5b8b85f (patch) | |
tree | 9a260a10ed34cee83fda1fd54f7a7f17c98e4aec /source/lib/system.c | |
parent | 47cc9359aa1b4d5fcd9469be0b1378030ac388fc (diff) | |
download | samba-07f562be7a64a2ded7ec0e6f5910447dc5b8b85f.tar.gz samba-07f562be7a64a2ded7ec0e6f5910447dc5b8b85f.tar.xz samba-07f562be7a64a2ded7ec0e6f5910447dc5b8b85f.zip |
r23470: Fix supplementary group list truncation for *BSD. We need to pass
the correct group list length and only truncate to NGROUPS_MAX if
it is too long.
Diffstat (limited to 'source/lib/system.c')
-rw-r--r-- | source/lib/system.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/lib/system.c b/source/lib/system.c index 2cc7ef6ca42..13f743faa4f 100644 --- a/source/lib/system.c +++ b/source/lib/system.c @@ -1018,10 +1018,16 @@ static int sys_bsd_setgroups(gid_t primary_gid, int setlen, const gid_t *gidset) setlen++; } + if (setlen > max) { + DEBUG(10, ("forced to truncate group list from %d to %d\n", + setlen, max)); + setlen = max; + } + #if defined(BROKEN_GETGROUPS) - ret = sys_broken_setgroups(max, new_gidset ? new_gidset : gidset); + ret = sys_broken_setgroups(setlen, new_gidset ? new_gidset : gidset); #else - ret = setgroups(max, new_gidset ? new_gidset : gidset); + ret = setgroups(setlen, new_gidset ? new_gidset : gidset); #endif if (new_gidset) { |