summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-06-08 19:52:18 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:23:12 -0500
commit334c961cc55aafb6b5587ba8ab517b94f1cbe278 (patch)
tree69855ed37a4ddea1701f6bb1bcbb60088a1586cb
parent19dbef7ca44298dc7e20d7f87f37efcda9db4432 (diff)
downloadsamba-334c961cc55aafb6b5587ba8ab517b94f1cbe278.tar.gz
samba-334c961cc55aafb6b5587ba8ab517b94f1cbe278.tar.bz2
samba-334c961cc55aafb6b5587ba8ab517b94f1cbe278.zip
r23390: First part of the patch to make Apple's life easier.
Doing this in two stages to make it very easy to review. Context switching must look like : gain_root(); sys_setgroups(ngroups, groups); become_id(uid, gid); Re-arrange order so these three calls are always seen together. Next will be to turn these into a function. Jeremy. (This used to be commit eb537185ee4a3f460709267c843c9303a9bb61b5)
-rw-r--r--source3/smbd/sec_ctx.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/source3/smbd/sec_ctx.c b/source3/smbd/sec_ctx.c
index be00db9adb..14faba5ee3 100644
--- a/source3/smbd/sec_ctx.c
+++ b/source3/smbd/sec_ctx.c
@@ -243,11 +243,13 @@ void set_sec_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *groups, NT_USER_TOKEN
debug_nt_user_token(DBGC_CLASS, 5, token);
debug_unix_user_token(DBGC_CLASS, 5, uid, gid, ngroups, groups);
+ /* Start context switch */
gain_root();
-
#ifdef HAVE_SETGROUPS
sys_setgroups(ngroups, groups);
#endif
+ become_id(uid, gid);
+ /* end context switch */
ctx_p->ut.ngroups = ngroups;
@@ -277,8 +279,6 @@ void set_sec_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *groups, NT_USER_TOKEN
ctx_p->token = NULL;
}
- become_id(uid, gid);
-
ctx_p->ut.uid = uid;
ctx_p->ut.gid = gid;
@@ -334,15 +334,15 @@ BOOL pop_sec_ctx(void)
sec_ctx_stack_ndx--;
- gain_root();
-
prev_ctx_p = &sec_ctx_stack[sec_ctx_stack_ndx];
+ /* Start context switch */
+ gain_root();
#ifdef HAVE_SETGROUPS
sys_setgroups(prev_ctx_p->ut.ngroups, prev_ctx_p->ut.groups);
#endif
-
become_id(prev_ctx_p->ut.uid, prev_ctx_p->ut.gid);
+ /* end context switch */
/* Update current_user stuff */