From 821bd95156e8cc6d843aecb0a27d4a08761b7dac Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 28 Jun 2012 11:59:51 -0700 Subject: Replace all uses of setXX[ug]id() and setgroups with samba_setXX[ug]id() calls. Will allow thread-specific credentials to be added by modifying the central definitions. Deliberately left the setXX[ug]id() call in popt as this is not used in Samba. --- lib/util/unix_privs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/util/unix_privs.c') diff --git a/lib/util/unix_privs.c b/lib/util/unix_privs.c index baa54fd558..3dd244dad1 100644 --- a/lib/util/unix_privs.c +++ b/lib/util/unix_privs.c @@ -22,6 +22,7 @@ #include "includes.h" #include "system/passwd.h" #include "../lib/util/unix_privs.h" +#include "../lib/util/setid.h" /** * @file @@ -52,7 +53,7 @@ struct saved_state { static int privileges_destructor(struct saved_state *s) { if (geteuid() != s->uid && - seteuid(s->uid) != 0) { + samba_seteuid(s->uid) != 0) { smb_panic("Failed to restore privileges"); } return 0; @@ -71,7 +72,7 @@ void *root_privileges(void) if (!s) return NULL; s->uid = geteuid(); if (s->uid != 0) { - seteuid(0); + samba_seteuid(0); } talloc_set_destructor(s, privileges_destructor); return s; -- cgit