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