From 8a785a60475bc4bc537fecd57e72fa78eb9b8df2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 11 May 2009 09:42:08 -0700 Subject: [PATCH] Add checks for non_root mode to help buildfarm spoolss tests. Reviewed by Guenther. Jeremy. --- source3/lib/smbrun.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/source3/lib/smbrun.c b/source3/lib/smbrun.c index 14e6a7690c8..75713d2aa2f 100644 --- a/source3/lib/smbrun.c +++ b/source3/lib/smbrun.c @@ -165,14 +165,16 @@ static int smbrun_internal(const char *cmd, int *outfd, bool sanitize) become_user_permanently(uid, gid); - if (getuid() != uid || geteuid() != uid || - getgid() != gid || getegid() != gid) { - /* we failed to lose our privileges - do not execute - the command */ - exit(81); /* we can't print stuff at this stage, - instead use exit codes for debugging */ + if (!non_root_mode()) { + if (getuid() != uid || geteuid() != uid || + getgid() != gid || getegid() != gid) { + /* we failed to lose our privileges - do not execute + the command */ + exit(81); /* we can't print stuff at this stage, + instead use exit codes for debugging */ + } } - + #ifndef __INSURE__ /* close all other file descriptors, leaving only 0, 1 and 2. 0 and 2 point to /dev/null from the startup code */ @@ -322,14 +324,16 @@ int smbrunsecret(const char *cmd, const char *secret) become_user_permanently(uid, gid); - if (getuid() != uid || geteuid() != uid || - getgid() != gid || getegid() != gid) { - /* we failed to lose our privileges - do not execute - the command */ - exit(81); /* we can't print stuff at this stage, - instead use exit codes for debugging */ + if (!non_root_mode()) { + if (getuid() != uid || geteuid() != uid || + getgid() != gid || getegid() != gid) { + /* we failed to lose our privileges - do not execute + the command */ + exit(81); /* we can't print stuff at this stage, + instead use exit codes for debugging */ + } } - + #ifndef __INSURE__ /* close all other file descriptors, leaving only 0, 1 and 2. 0 and 2 point to /dev/null from the startup code */ -- 2.34.1