Bug 7473 - wrong logic in .../source3/lib/system.c when checking for HAVE_SETGROUPS
wrong logic in .../source3/lib/system.c when checking for HAVE_SETGROUPS
Status: NEW
Product: Samba 3.6
Classification: Unclassified
Component: Build environment
3.6.8
Other Other
: P3 normal
: ---
Assigned To: Volker Lendecke
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-28 02:39 UTC by Joachim Schmitz
Modified: 2012-09-17 12:35 UTC (History)
1 user (show)

See Also:


Attachments
Patch (1.03 KB, patch)
2010-06-01 04:17 UTC, Joachim Schmitz
no flags Details
patch for system.c (683 bytes, patch)
2010-06-08 07:10 UTC, Joachim Schmitz
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joachim Schmitz 2010-05-28 02:39:46 UTC
wrong logic in .../source3/lib/system.c when checking for HAVE_SETGROUPS.
Patch:

diff -u ./source3/lib/system.c.orig ./source3/lib/system.c
--- ./source3/lib/system.c.orig	2010-05-17 06:51:23.000000000 -0500
+++ ./source3/lib/system.c	2010-05-27 07:13:48.000000000 -0500
@@ -1201,17 +1205,15 @@
 
 int sys_setgroups(gid_t UNUSED(primary_gid), int setlen, gid_t *gidset)
 {
-#if !defined(HAVE_SETGROUPS)
-	errno = ENOSYS;
-	return -1;
-#endif /* HAVE_SETGROUPS */
-
 #if defined(USE_BSD_SETGROUPS)
 	return sys_bsd_setgroups(primary_gid, setlen, gidset);
 #elif defined(HAVE_BROKEN_GETGROUPS)
 	return sys_broken_setgroups(setlen, gidset);
-#else
+#elif defined(HAVE_SETGROUPS)
 	return setgroups(setlen, gidset);
+#else
+	errno = ENOSYS;
+	return -1;
 #endif
 }
 

There's a releated but very old and closed report, #545.

Bye, Jojo
Comment 1 Joachim Schmitz 2010-06-01 04:17:09 UTC
Created attachment 5755 [details]
Patch
Comment 2 Joachim Schmitz 2010-06-08 07:10:47 UTC
Created attachment 5770 [details]
patch for system.c

removing an unrelated hunk from my patch
Comment 3 Björn Jacke 2012-09-14 14:10:45 UTC
Hmm, not sure about this. Don't we also mess around with samba_setgroups and sys_setgroups?

Might this have to do with setgroups bugs some people see on some platforms? Volker, can you have a look at this?
Comment 4 Joachim Schmitz 2012-09-14 14:20:06 UTC
(In reply to comment #3)
Same patch still seems to be needed in Samba 3.6.7