@@ -73,7 +73,7 @@ def cacheGet(self, cache, key, func):
73
73
74
74
def permissionsHigh ():
75
75
"""Sets the effective gid/uid to processes original values (root)"""
76
- if platform .system () == "Windows" :
76
+ if platform .system () == "Windows" or not rqd . rqconstants . RQD_BECOME_JOB_USER :
77
77
return
78
78
PERMISSIONS .acquire ()
79
79
os .setegid (os .getgid ())
@@ -87,7 +87,7 @@ def permissionsHigh():
87
87
def permissionsLow ():
88
88
"""Sets the effective gid/uid to one with less permissions:
89
89
RQD_GID and RQD_UID"""
90
- if platform .system () in ('Windows' , 'Darwin' ):
90
+ if platform .system () in ('Windows' , 'Darwin' ) or not rqd . rqconstants . RQD_BECOME_JOB_USER :
91
91
return
92
92
if os .getegid () != rqd .rqconstants .RQD_GID or os .geteuid () != rqd .rqconstants .RQD_UID :
93
93
__becomeRoot ()
@@ -100,7 +100,7 @@ def permissionsLow():
100
100
101
101
def permissionsUser (uid , gid ):
102
102
"""Sets the effective gid/uid to supplied values"""
103
- if platform .system () in ('Windows' , 'Darwin' ):
103
+ if platform .system () in ('Windows' , 'Darwin' ) or not rqd . rqconstants . RQD_BECOME_JOB_USER :
104
104
return
105
105
PERMISSIONS .acquire ()
106
106
__becomeRoot ()
@@ -128,6 +128,8 @@ def __becomeRoot():
128
128
def checkAndCreateUser (username ):
129
129
"""Check to see if the provided user exists, if not attempt to create it."""
130
130
# TODO(gregdenton): Add Windows and Mac support here. (Issue #61)
131
+ if not rqd .rqconstants .RQD_BECOME_JOB_USER :
132
+ return
131
133
try :
132
134
pwd .getpwnam (username )
133
135
return
0 commit comments