Author: jpeach
Date: 2007-09-14 04:17:17 +0000 (Fri, 14 Sep 2007)
New Revision: 25142

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

Log:
Panic if setting the group list fails while switching security
contexts. Patch from Tim Prouty <[EMAIL PROTECTED]>.

Modified:
   branches/SAMBA_3_2/source/smbd/sec_ctx.c
   branches/SAMBA_3_2_0/source/smbd/sec_ctx.c


Changeset:
Modified: branches/SAMBA_3_2/source/smbd/sec_ctx.c
===================================================================
--- branches/SAMBA_3_2/source/smbd/sec_ctx.c    2007-09-14 01:07:57 UTC (rev 
25141)
+++ branches/SAMBA_3_2/source/smbd/sec_ctx.c    2007-09-14 04:17:17 UTC (rev 
25142)
@@ -239,7 +239,9 @@
        /* Start context switch */
        gain_root();
 #ifdef HAVE_SETGROUPS
-       sys_setgroups(gid, ngroups, groups);
+       if (sys_setgroups(gid, ngroups, groups) != 0) {
+               smb_panic("sys_setgroups failed");
+       }
 #endif
        become_id(uid, gid);
        /* end context switch */
@@ -282,6 +284,7 @@
                DEBUG(0, ("WARNING: failed to set group list "
                        "(%d groups) for UID %ld: %s\n",
                        ngroups, uid, strerror(errno)));
+               smb_panic("sys_setgroups failed");
        }
 
        become_uid(uid);

Modified: branches/SAMBA_3_2_0/source/smbd/sec_ctx.c
===================================================================
--- branches/SAMBA_3_2_0/source/smbd/sec_ctx.c  2007-09-14 01:07:57 UTC (rev 
25141)
+++ branches/SAMBA_3_2_0/source/smbd/sec_ctx.c  2007-09-14 04:17:17 UTC (rev 
25142)
@@ -239,7 +239,9 @@
        /* Start context switch */
        gain_root();
 #ifdef HAVE_SETGROUPS
-       sys_setgroups(gid, ngroups, groups);
+       if (sys_setgroups(gid, ngroups, groups) != 0) {
+               smb_panic("sys_setgroups failed");
+       }
 #endif
        become_id(uid, gid);
        /* end context switch */
@@ -282,6 +284,7 @@
                DEBUG(0, ("WARNING: failed to set group list "
                        "(%d groups) for UID %ld: %s\n",
                        ngroups, uid, strerror(errno)));
+               smb_panic("sys_setgroups failed");
        }
 
        become_uid(uid);

Reply via email to