summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c7548f7)
raw | patch | inline | side by side (parent: c7548f7)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sat, 27 Oct 2001 00:12:21 +0000 (00:12 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sat, 27 Oct 2001 00:12:21 +0000 (00:12 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@340 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup-server | patch | blob | history |
diff --git a/roundup-server b/roundup-server
index 090e46ca8fe2c3df10fb775bf7348f4652a8c1bc..1309088706555de111c5c3d9db6963370453a23c 100755 (executable)
--- a/roundup-server
+++ b/roundup-server
Based on CGIHTTPServer in the Python library.
-$Id: roundup-server,v 1.15 2001-10-12 02:23:26 richard Exp $
+$Id: roundup-server,v 1.16 2001-10-27 00:12:21 richard Exp $
"""
import sys
elif opt == '-u': user = arg
elif opt == '-h': usage()
- # if root, setuid to the running user
- if not os.getuid() and user is not None:
- try:
- import pwd
- except ImportError:
- raise ValueError, "Can't change users - no pwd module"
- try:
- uid = pwd.getpwnam(user)[2]
- except KeyError:
- raise ValueError, "User %s doesn't exist"%user
- os.setuid(uid)
- elif os.getuid() and user is not None:
- print 'WARNING: ignoring "-u" argument, not root'
-
- # People can remove this check if they're really determined
- if not os.getuid() and user is None:
- raise ValueError, "Can't run as root!"
+ if hasattr(os, 'getuid'):
+ # if root, setuid to the running user
+ if not os.getuid() and user is not None:
+ try:
+ import pwd
+ except ImportError:
+ raise ValueError, "Can't change users - no pwd module"
+ try:
+ uid = pwd.getpwnam(user)[2]
+ except KeyError:
+ raise ValueError, "User %s doesn't exist"%user
+ os.setuid(uid)
+ elif os.getuid() and user is not None:
+ print 'WARNING: ignoring "-u" argument, not root'
+
+ # People can remove this check if they're really determined
+ if not os.getuid() and user is None:
+ raise ValueError, "Can't run as root!"
# handle instance specs
if args:
#
# $Log: not supported by cvs2svn $
+# Revision 1.15 2001/10/12 02:23:26 richard
+# Didn't clean up after myself :)
+#
# Revision 1.14 2001/10/12 02:20:32 richard
# server now handles setuid'ing much better
#