Hi,

Attached is the patch that adds warning when an IP is passed to --server in ipa-client-install (https://fedorahosted.org/freeipa/ticket/4932).


Standa
From 478eb97dd379054e81f01a46fd1641c55628a4a7 Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka <slazn...@redhat.com>
Date: Tue, 11 Aug 2015 10:10:48 +0200
Subject: [PATCH] ipa-client-install: warn when IP used in --server

ipa-client-install fails when an IP address is passed
to ipa-join instead of a FQDN

https://fedorahosted.org/freeipa/ticket/4932
---
 ipa-client/ipa-install/ipa-client-install | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install
index 17cd2b6879aeb0c4b80dae9fe4218c0a741c0990..c0e8d6d1c2553aa78bed61df12893d0d5ff26dd7 100755
--- a/ipa-client/ipa-install/ipa-client-install
+++ b/ipa-client/ipa-install/ipa-client-install
@@ -2305,6 +2305,25 @@ def install(options, env, fstore, statestore):
     root_logger.info("BaseDN: %s", cli_basedn)
     root_logger.debug("BaseDN source: %s", cli_basedn_source)
 
+    # ipa-join would fail with IP address instead of a FQDN
+    for srv in cli_server:
+        try:
+            socket.inet_pton(socket.AF_INET, srv)
+            is_ipaddr = True
+        except:
+            try:
+                socket.inet_pton(socket.AF_INET6, srv)
+                is_ipaddr = True
+            except:
+                is_ipaddr = False
+
+        if is_ipaddr:
+            print
+            root_logger.warning("It seems that you are using an IP address "
+                                "instead of FQDN as an argument to --server. The "
+                                "installation may fail.")
+            break
+
     print
     if not options.unattended and not user_input("Continue to configure the system with these values?", False):
         return CLIENT_INSTALL_ERROR
-- 
2.4.3

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to