Client install root privileges check

ipa-client-install was failing and returning traceback when
wasn't run by root. It was caused by logging initialization that
was taking part before the root privileges check. To correct it,
the check was moved before the logging initialization.

https://fedorahosted.org/freeipa/ticket/2123
This commit is contained in:
Ondrej Hamada 2011-11-18 13:55:16 +01:00 committed by Martin Kosek
parent e84bd27af2
commit bf57388e54

View File

@ -1250,11 +1250,11 @@ def install(options, env, fstore, statestore):
def main():
safe_options, options = parse_options()
if not os.getegid() == 0:
sys.exit("\nYou must be root to run ipa-client-install.\n")
logging_setup(options)
logging.debug('%s was invoked with options: %s' % (sys.argv[0], safe_options))
logging.debug("missing options might be asked for interactively later\n")
if not os.getegid() == 0:
sys.exit("\nYou must be root to run ipa-client-install.\n")
env={"PATH":"/bin:/sbin:/usr/kerberos/bin:/usr/kerberos/sbin:/usr/bin:/usr/sbin"}