summaryrefslogtreecommitdiff
path: root/source3/lib/smbrun.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-05-11 09:42:08 -0700
committerJeremy Allison <jra@samba.org>2009-05-11 09:42:08 -0700
commit8a785a60475bc4bc537fecd57e72fa78eb9b8df2 (patch)
tree0377988ef15a650f35ed43a75a0f68db52f2e17a /source3/lib/smbrun.c
parenta82bb4bd516e6a8e50c0272b79df8e506ea0cc91 (diff)
downloadsamba-8a785a60475bc4bc537fecd57e72fa78eb9b8df2.tar.gz
samba-8a785a60475bc4bc537fecd57e72fa78eb9b8df2.tar.bz2
samba-8a785a60475bc4bc537fecd57e72fa78eb9b8df2.zip
Add checks for non_root mode to help buildfarm spoolss tests.
Reviewed by Guenther. Jeremy.
Diffstat (limited to 'source3/lib/smbrun.c')
-rw-r--r--source3/lib/smbrun.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/source3/lib/smbrun.c b/source3/lib/smbrun.c
index 14e6a7690c..75713d2aa2 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 */