[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Freeipa-devel] [PATCH] 24 Verify that the hostname is fully-qualified



On 23.6.2011 17:19, Martin Kosek wrote:
On Thu, 2011-06-23 at 16:33 +0200, Jan Cholasta wrote:
This patch makes ipactl fail if the hostname isn't fully-qualified. It
also fixes ipa-server-install to fail gracefully in such case, instead
of failing with unexpected error.

https://fedorahosted.org/freeipa/ticket/1035

Honza

You may want to coordinate yourself with Rob here. His patch 762 for
custom hostname was sent yesterday and was ACK-ed today. Otherwise your
2 patches will clash. You fixed the same line in ipactl for example.

Martin



Rebased the patch to master.

Honza

--
Jan Cholasta
>From 395345fc6cb28590ecbf9a5bd21228829fbd9b0b Mon Sep 17 00:00:00 2001
From: Jan Cholasta <jcholast redhat com>
Date: Fri, 24 Jun 2011 16:56:25 +0200
Subject: [PATCH] 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
---
 install/tools/ipa-server-install |   15 +++++++--------
 install/tools/ipactl             |    3 +++
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install
index 09cc8a0..504da2c 100755
--- a/install/tools/ipa-server-install
+++ b/install/tools/ipa-server-install
@@ -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)
diff --git a/install/tools/ipactl b/install/tools/ipactl
index 01b88a5..a944517 100755
--- a/install/tools/ipactl
+++ b/install/tools/ipactl
@@ -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":
-- 
1.7.4.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]