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

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