andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From 4bd0b7b1fe8fb970d3a17d971033822d404835da Mon Sep 17 00:00:00 2001
dc8c34
From: William Brown <firstyear@redhat.com>
dc8c34
Date: Thu, 26 Nov 2015 13:11:17 +1000
dc8c34
Subject: [PATCH 371/375] Ticket 48332 - allow users to specify to relax the
dc8c34
 FQDN constraint
dc8c34
dc8c34
Bug Description:  There are situations when the machine name for ds may not
dc8c34
match the dns name. In these cases we should allow installation without the
dc8c34
strict hostname checks we carry out.
dc8c34
dc8c34
Fix Description:  Add a new option, General.StrictHostCheck which defaults
dc8c34
to true. If true, host name checking is carried out. If false, it is disabled
dc8c34
and any hostname in General.FullMachineName is considered valid.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/48332
dc8c34
dc8c34
Author: wibrown
dc8c34
dc8c34
Review by: rmeggins (Thanks!)
dc8c34
dc8c34
(cherry picked from commit 026956c7e3b4dc00b6738f9a195e6653fed03d79)
dc8c34
(cherry picked from commit 5d0f57335c1bf97529849d5d47cad769083052d0)
dc8c34
(cherry picked from commit e62ef7f4d19d78d015efa915f7740f4d8b615da4)
dc8c34
(cherry picked from commit 3f2ea36e763c8e08b88265bd365c6daa5081419c)
dc8c34
---
dc8c34
 ldap/admin/src/scripts/DSCreate.pm.in | 19 ++++++++++++++++---
dc8c34
 1 file changed, 16 insertions(+), 3 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/admin/src/scripts/DSCreate.pm.in b/ldap/admin/src/scripts/DSCreate.pm.in
dc8c34
index b7f9498..dbfcedf 100644
dc8c34
--- a/ldap/admin/src/scripts/DSCreate.pm.in
dc8c34
+++ b/ldap/admin/src/scripts/DSCreate.pm.in
dc8c34
@@ -150,9 +150,18 @@ sub sanityCheckParams {
dc8c34
         debug(0, "WARNING: The root password is less than 8 characters long.  You should choose a longer one.\n");
dc8c34
     }
dc8c34
 
dc8c34
-    if (@errs = checkHostname($inf->{General}->{FullMachineName}, 0)) {
dc8c34
-        debug(1, @errs);
dc8c34
-        return @errs;
dc8c34
+    $inf->{General}->{StrictHostCheck} = lc $inf->{General}->{StrictHostCheck};
dc8c34
+
dc8c34
+    if ("true" ne $inf->{General}->{StrictHostCheck} && "false" ne $inf->{General}->{StrictHostCheck}) {
dc8c34
+        debug(1, "StrictHostCheck is not a valid boolean");
dc8c34
+        return ('error_invalid_boolean', $inf->{General}->{StrictHostCheck});
dc8c34
+    }
dc8c34
+
dc8c34
+    if ($inf->{General}->{StrictHostCheck} eq "true" ) {
dc8c34
+        if (@errs = checkHostname($inf->{General}->{FullMachineName}, 0)) {
dc8c34
+            debug(1, @errs);
dc8c34
+            return @errs;
dc8c34
+        }
dc8c34
     }
dc8c34
 
dc8c34
     return ();
dc8c34
@@ -888,6 +897,10 @@ sub setDefaults {
dc8c34
                                                   "@datadir@",
dc8c34
                                                   $inf->{General}->{prefix});
dc8c34
 
dc8c34
+    if (!defined($inf->{General}->{StrictHostCheck})) {
dc8c34
+        $inf->{General}->{StrictHostCheck} = "true";
dc8c34
+    }
dc8c34
+
dc8c34
     if (!defined($inf->{slapd}->{inst_dir})) {
dc8c34
         $inf->{slapd}->{inst_dir} = "$inf->{General}->{ServerRoot}/slapd-$servid";
dc8c34
     }
dc8c34
-- 
dc8c34
2.4.3
dc8c34