[Zope3-checkins] SVN: zdaemon/trunk/src/zdaemon/zd Moved set_uid
out to the ctl script.
Jim Fulton
jim at zope.com
Thu Jan 11 15:40:55 EST 2007
Log message for revision 71933:
Moved set_uid out to the ctl script.
Changed:
U zdaemon/trunk/src/zdaemon/zdctl.py
U zdaemon/trunk/src/zdaemon/zdrun.py
-=-
Modified: zdaemon/trunk/src/zdaemon/zdctl.py
===================================================================
--- zdaemon/trunk/src/zdaemon/zdctl.py 2007-01-11 20:04:04 UTC (rev 71932)
+++ zdaemon/trunk/src/zdaemon/zdctl.py 2007-01-11 20:40:54 UTC (rev 71933)
@@ -141,6 +141,17 @@
for k, v in options.configroot.environment.mapping.items():
os.environ[k] = v
+ self.set_uid()
+
+ def set_uid(self):
+ if self.options.uid is None:
+ return
+ uid = os.geteuid()
+ if uid != 0 and uid != self.options.uid:
+ self.options.usage("only root can use -u USER to change users")
+ os.setgid(self.options.gid)
+ os.setuid(self.options.uid)
+
def emptyline(self):
# We don't want a blank line to repeat the last command.
# Showing status is a nice alternative.
Modified: zdaemon/trunk/src/zdaemon/zdrun.py
===================================================================
--- zdaemon/trunk/src/zdaemon/zdrun.py 2007-01-11 20:04:04 UTC (rev 71932)
+++ zdaemon/trunk/src/zdaemon/zdrun.py 2007-01-11 20:40:54 UTC (rev 71933)
@@ -248,18 +248,8 @@
self.options = ZDRunOptions()
self.options.realize(args)
self.logger = self.options.logger
- self.set_uid()
self.run()
- def set_uid(self):
- if self.options.uid is None:
- return
- uid = os.geteuid()
- if uid != 0 and uid != self.options.uid:
- self.options.usage("only root can use -u USER to change users")
- os.setgid(self.options.gid)
- os.setuid(self.options.uid)
-
def run(self):
self.proc = Subprocess(self.options)
self.opensocket()
More information about the Zope3-Checkins
mailing list