summaryrefslogtreecommitdiffstats
path: root/source/smbd/sec_ctx.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/smbd/sec_ctx.c')
-rw-r--r--source/smbd/sec_ctx.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/smbd/sec_ctx.c b/source/smbd/sec_ctx.c
index 67b15dc014c..08d522cdd7a 100644
--- a/source/smbd/sec_ctx.c
+++ b/source/smbd/sec_ctx.c
@@ -239,7 +239,9 @@ static void set_unix_security_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *grou
/* Start context switch */
gain_root();
#ifdef HAVE_SETGROUPS
- sys_setgroups(gid, ngroups, groups);
+ if (sys_setgroups(gid, ngroups, groups) != 0 && !non_root_mode()) {
+ smb_panic("sys_setgroups failed");
+ }
#endif
become_id(uid, gid);
/* end context switch */
@@ -278,10 +280,11 @@ static void set_unix_security_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *grou
if (syscall(SYS_initgroups, (ngroups > max) ? max : ngroups,
- groups, uid) == 1) {
+ groups, uid) == -1 && !non_root_mode()) {
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);