svn commit: samba r23473 - in branches/SAMBA_3_0_26/source/lib: . Author: jpeach
Date: 2007-06-13 20:45:55 +0000 (Wed, 13 Jun 2007)
New Revision: 23473

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23473

Log:
Merge Merge branches/SAMBA_3_0@23470

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.

Modified:
   branches/SAMBA_3_0_26/source/lib/system.c


Changeset:
Modified: branches/SAMBA_3_0_26/source/lib/system.c
===================================================================
--- branches/SAMBA_3_0_26/source/lib/system.c	2007-06-13 20:43:49 UTC (rev 23472)
+++ branches/SAMBA_3_0_26/source/lib/system.c	2007-06-13 20:45:55 UTC (rev 23473)
@@ -1018,10 +1018,16 @@
 		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) {

