Verify that the hostname is fully-qualified before accessing the service information in ipactl.

Fail gracefully if the supplied hostname isn't fully-qualified in
ipa-server-install.

ticket 1035
This commit is contained in:
Jan Cholasta 2011-06-24 16:56:25 +02:00 committed by Rob Crittenden
parent b02b77f8d7
commit 3656d9be3c
2 changed files with 10 additions and 8 deletions

View File

@ -573,15 +573,14 @@ def main():
else:
host_default = get_fqdn()
if options.unattended:
try:
try:
if options.unattended:
verify_fqdn(host_default,options.no_host_dns)
except RuntimeError, e:
sys.exit(str(e) + "\n")
host_name = host_default
else:
host_name = read_host_name(host_default,options.no_host_dns)
host_name = host_default
else:
host_name = read_host_name(host_default,options.no_host_dns)
except RuntimeError, e:
sys.exit(str(e) + "\n")
host_name = host_name.lower()
logging.debug("will use host_name: %s\n" % host_name)

View File

@ -295,6 +295,9 @@ def main():
api.bootstrap(context='cli', debug=options.debug)
api.finalize()
if '.' not in api.env.host:
raise IpactlError("Invalid hostname, must be fully-qualified")
if args[0].lower() == "start":
ipa_start()
elif args[0].lower() == "stop":