From: richard Date: Sat, 27 Oct 2001 00:12:21 +0000 (+0000) Subject: Fixed roundup-server for windows, thanks Juergen Hermann. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=68cea0b23b2648cbe19e2e119a54ae6cd9aa7dec;p=roundup.git Fixed roundup-server for windows, thanks Juergen Hermann. git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@340 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/roundup-server b/roundup-server index 090e46c..1309088 100755 --- a/roundup-server +++ b/roundup-server @@ -20,7 +20,7 @@ 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 @@ -216,23 +216,24 @@ def main(): 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: @@ -260,6 +261,9 @@ if __name__ == '__main__': # # $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 #