summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2012-05-11 15:56:43 -0400
committerMartin Kosek <mkosek@redhat.com>2012-05-17 08:01:42 +0200
commit13b51f3011bfb5c5c265e08c6f207f769dbde807 (patch)
tree0e4aabb5b2da6cfb8a4d880ddc2465dd6801d684 /install
parenteef056165f437e07c4a792d5545817a5517c59de (diff)
downloadfreeipa-13b51f3011bfb5c5c265e08c6f207f769dbde807.tar.gz
freeipa-13b51f3011bfb5c5c265e08c6f207f769dbde807.tar.xz
freeipa-13b51f3011bfb5c5c265e08c6f207f769dbde807.zip
Validate on the user-provided domain name in the installer.
Wrap printing exceptions in unicode() to do Gettext conversion. https://fedorahosted.org/freeipa/ticket/2196
Diffstat (limited to 'install')
-rwxr-xr-xinstall/tools/ipa-server-install15
1 files changed, 13 insertions, 2 deletions
diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install
index a5aa1deda..d3327a680 100755
--- a/install/tools/ipa-server-install
+++ b/install/tools/ipa-server-install
@@ -63,6 +63,7 @@ from ipapython.config import IPAOptionParser
from ipalib.dn import DN
from ipalib.x509 import load_certificate_from_file, load_certificate_chain_from_file
from ipalib.constants import DNS_ZONE_REFRESH
+from ipalib.util import validate_domain_name
from ipapython import services as ipaservices
from ipapython.ipa_log_manager import *
@@ -228,6 +229,12 @@ def parse_options():
if options.admin_password is not None and len(options.admin_password) < 8:
parser.error("Admin user password must be at least 8 characters long")
+ if options.domain_name is not None:
+ try:
+ validate_domain_name(options.domain_name)
+ except ValueError, e:
+ parser.error("invalid domain: " + unicode(e))
+
if not options.setup_dns:
if options.forwarders:
parser.error("You cannot specify a --forwarder option without the --setup-dns option")
@@ -726,6 +733,10 @@ def main():
if not options.domain_name:
domain_name = read_domain_name(host_name[host_name.find(".")+1:], options.unattended)
root_logger.debug("read domain_name: %s\n" % domain_name)
+ try:
+ validate_domain_name(domain_name)
+ except ValueError, e:
+ sys.exit("Invalid domain name: %s" % unicode(e))
else:
domain_name = options.domain_name
@@ -1111,9 +1122,9 @@ try:
except Exception, e:
success = False
if uninstalling:
- message = "Unexpected error - see ipaserver-uninstall.log for details:\n %s" % str(e)
+ message = "Unexpected error - see ipaserver-uninstall.log for details:\n %s" % unicode(e)
else:
- message = "Unexpected error - see ipaserver-install.log for details:\n %s" % str(e)
+ message = "Unexpected error - see ipaserver-install.log for details:\n %s" % unicode(e)
print message
message = str(e)
for str in traceback.format_tb(sys.exc_info()[2]):