zrhoffman / rpms / 389-ds-base

Forked from rpms/389-ds-base 3 years ago
Clone
Blob Blame History Raw
From 451838933f9989d1ff9c46dbb3cae7619166a4d8 Mon Sep 17 00:00:00 2001
From: Thierry Bordaz <tbordaz@redhat.com>
Date: Fri, 21 Oct 2016 16:28:59 +0200
Subject: [PATCH 67/67] Ticket 49016 - (un)register/migration/remove may fail
 if there is no suffix on 'userRoot' backend

Bug Description:
    If an instance has no suffix on 'userRoot' backend, then the info structure
    may contain empty 'Suffix'.
    In fact if the last backend has no suffix (like cn=config), it overwite all
    previsously found value.
    This affect register (and possibly unregister/migrate/remove)

Fix Description:
    Before overwriting the 'Suffix' value, check that the found backend contains
    'nsslapd-suffix'.

https://fedorahosted.org/389/ticket/49016

Reviewed by: Noriko Hosoi (Thank you Noriko)

Platforms tested: RHEL 7.2

Flag Day: no

Doc impact: no

(cherry picked from commit 1bafab5ae1e894ae3680679e03e457b9ace7e7d2)
---
 ldap/admin/src/scripts/DSUtil.pm.in | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ldap/admin/src/scripts/DSUtil.pm.in b/ldap/admin/src/scripts/DSUtil.pm.in
index 756d6ea..eac59a3 100644
--- a/ldap/admin/src/scripts/DSUtil.pm.in
+++ b/ldap/admin/src/scripts/DSUtil.pm.in
@@ -975,7 +975,9 @@ sub createInfFromConfig {
     }
     # use the userRoot suffix if available
     while ($ent) {
-        $suffix = $ent->getValues('nsslapd-suffix');
+        if ($ent->getValues('nsslapd-suffix')) {
+            $suffix = $ent->getValues('nsslapd-suffix');
+        }
         last if ($ent->hasValue('cn', 'userRoot', 1));
         $ent = $conn->nextEntry();
     }
-- 
2.9.3