Blame SOURCES/0014-Issue-5412-lib389-do-not-set-backend-name-to-lowerca.patch

cb1cc6
From 6fd4fd082424838f7d06e0de8683d28f04ec0d43 Mon Sep 17 00:00:00 2001
cb1cc6
From: Mark Reynolds <mreynolds@redhat.com>
cb1cc6
Date: Wed, 10 Aug 2022 08:59:15 -0400
cb1cc6
Subject: [PATCH 2/4] Issue 5412 - lib389 - do not set backend name to
cb1cc6
 lowercase
cb1cc6
cb1cc6
Description:
cb1cc6
cb1cc6
There is no reason to set a new suffix to lowercase.  The server
cb1cc6
will correctly handle the case, and some customers, especially
cb1cc6
with migrations, want to have the base suffix a certain case.
cb1cc6
cb1cc6
relates: https://github.com/389ds/389-ds-base/issues/5412
cb1cc6
cb1cc6
Reviewed by: spichugi(Thanks!)
cb1cc6
---
cb1cc6
 dirsrvtests/tests/suites/basic/basic_test.py | 33 ++++++++++++++++++--
cb1cc6
 src/lib389/lib389/backend.py                 |  3 +-
cb1cc6
 2 files changed, 32 insertions(+), 4 deletions(-)
cb1cc6
cb1cc6
diff --git a/dirsrvtests/tests/suites/basic/basic_test.py b/dirsrvtests/tests/suites/basic/basic_test.py
cb1cc6
index 003cd8f28..6fa4dea25 100644
cb1cc6
--- a/dirsrvtests/tests/suites/basic/basic_test.py
cb1cc6
+++ b/dirsrvtests/tests/suites/basic/basic_test.py
cb1cc6
@@ -22,6 +22,8 @@ from lib389.idm.directorymanager import DirectoryManager
cb1cc6
 from lib389.config import LDBMConfig
cb1cc6
 from lib389.dseldif import DSEldif
cb1cc6
 from lib389.rootdse import RootDSE
cb1cc6
+from lib389.backend import Backends
cb1cc6
+from lib389.idm.domain import Domain
cb1cc6
 
cb1cc6
 
cb1cc6
 pytestmark = pytest.mark.tier0
cb1cc6
@@ -1410,8 +1412,35 @@ def test_ldbm_modification_audit_log(topology_st):
cb1cc6
         assert conn.searchAuditLog('%s: %s' % (attr, VALUE))
cb1cc6
 
cb1cc6
 
cb1cc6
-@pytest.mark.skipif(not get_user_is_root() or ds_is_older('1.4.0.0'),
cb1cc6
-                    reason="This test is only required if perl is enabled, and requires root.")
cb1cc6
+def test_suffix_case(topology_st):
cb1cc6
+    """Test that the suffix case is preserved when creating a new backend
cb1cc6
+
cb1cc6
+    :id: 4eff15be-6cde-4312-b492-c88941876bda
cb1cc6
+    :setup: Standalone Instance
cb1cc6
+    :steps:
cb1cc6
+        1. Create backend with uppercase characters
cb1cc6
+        2. Create root node entry
cb1cc6
+        3. Search should return suffix with upper case characters
cb1cc6
+    :expectedresults:
cb1cc6
+        1. Success
cb1cc6
+        2. Success
cb1cc6
+        3. Success
cb1cc6
+    """
cb1cc6
+
cb1cc6
+    # Start with a clean slate
cb1cc6
+    topology_st.standalone.restart()
cb1cc6
+
cb1cc6
+    TEST_SUFFIX = 'dc=UPPER_CASE'
cb1cc6
+
cb1cc6
+    backends = Backends(topology_st.standalone)
cb1cc6
+    backends.create(properties={'nsslapd-suffix': TEST_SUFFIX,
cb1cc6
+                                'name': 'upperCaseRoot',
cb1cc6
+                                'sample_entries': '001004002'})
cb1cc6
+                           
cb1cc6
+    domain = Domain(topology_st.standalone, TEST_SUFFIX)
cb1cc6
+    assert domain.dn == TEST_SUFFIX
cb1cc6
+
cb1cc6
+    
cb1cc6
 def test_dscreate(request):
cb1cc6
     """Test that dscreate works, we need this for now until setup-ds.pl is
cb1cc6
     fully discontinued.
cb1cc6
diff --git a/src/lib389/lib389/backend.py b/src/lib389/lib389/backend.py
cb1cc6
index cbd2810e9..24613655d 100644
cb1cc6
--- a/src/lib389/lib389/backend.py
cb1cc6
+++ b/src/lib389/lib389/backend.py
cb1cc6
@@ -608,8 +608,7 @@ class Backend(DSLdapObject):
cb1cc6
             dn = ",".join(dn_comps)
cb1cc6
 
cb1cc6
         if properties is not None:
cb1cc6
-            suffix_dn = properties['nsslapd-suffix'].lower()
cb1cc6
-            dn_comps = ldap.dn.explode_dn(suffix_dn)
cb1cc6
+            dn_comps = ldap.dn.explode_dn(properties['nsslapd-suffix'])
cb1cc6
             ndn = ",".join(dn_comps)
cb1cc6
             properties['nsslapd-suffix'] = ndn
cb1cc6
             sample_entries = properties.pop(BACKEND_SAMPLE_ENTRIES, False)
cb1cc6
-- 
cb1cc6
2.37.1
cb1cc6