File 0002-Revert-Issue-6417-2nd-If-an-entry-RDN-is-identical-t.patch of Package 389-ds.39635

From 855f2c4351351675e50931bbc63f528cfb9b2a58 Mon Sep 17 00:00:00 2001
From: William <william@blackhats.net.au>
Date: Wed, 2 Jul 2025 12:56:41 +1000
Subject: [PATCH 2/3] Revert "Issue 6417 - (2nd) If an entry RDN is identical
 to the suffix, then Entryrdn gets broken during a reindex (#6460)"

This reverts commit 09ef190e5eb13680fb71631b5cf591878d7a1d76.
---
 .../suites/replication/regression_m2_test.py  |  9 ---------
 ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c  | 19 +------------------
 2 files changed, 1 insertion(+), 27 deletions(-)

diff --git a/dirsrvtests/tests/suites/replication/regression_m2_test.py b/dirsrvtests/tests/suites/replication/regression_m2_test.py
index 9c707615f..efb0a078c 100644
--- a/dirsrvtests/tests/suites/replication/regression_m2_test.py
+++ b/dirsrvtests/tests/suites/replication/regression_m2_test.py
@@ -1010,15 +1010,6 @@ def test_online_reinit_may_hang(topo_with_sigkill):
     """
     M1 = topo_with_sigkill.ms["supplier1"]
     M2 = topo_with_sigkill.ms["supplier2"]
-
-    # The RFE 5367 (when enabled) retrieves the DN
-    # from the dncache. This hides an issue
-    # with primary fix for 6417.
-    # We need to disable the RFE to verify that the primary
-    # fix is properly fixed.
-    if ds_is_newer('2.3.1'):
-        M1.config.replace('nsslapd-return-original-entrydn', 'off')
-
     M1.stop()
     ldif_file = '%s/supplier1.ldif' % M1.get_ldif_dir()
     M1.db2ldif(bename=DEFAULT_BENAME, suffixes=[DEFAULT_SUFFIX],
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c
index 7ff85b6d4..d70ea0471 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c
@@ -1001,7 +1001,6 @@ entryrdn_lookup_dn(backend *be,
     rdn_elem *elem = NULL;
     int maybesuffix = 0;
     int db_retry = 0;
-    ID suffix_id = 1;
 
     slapi_log_err(SLAPI_LOG_TRACE, "entryrdn_lookup_dn",
                   "--> entryrdn_lookup_dn\n");
@@ -1061,22 +1060,6 @@ entryrdn_lookup_dn(backend *be,
     /* Setting the bulk fetch buffer */
     dblayer_value_init(be, &data);
 
-    /* Just in case the suffix ID is not '1' retrieve it from the database */
-    keybuf = slapi_ch_strdup(slapi_sdn_get_ndn(be->be_suffix));
-    dblayer_value_set(be, &key, keybuf, strlen(keybuf) + 1);
-    rc = dblayer_cursor_op(&cursor, DBI_OP_MOVE_TO_KEY, &key, &data);
-    if (rc) {
-        slapi_log_err(SLAPI_LOG_WARNING, "entryrdn_lookup_dn",
-                      "Fails to retrieve the ID of suffix %s - keep the default value '%d'\n",
-                      slapi_sdn_get_ndn(be->be_suffix),
-                      suffix_id);
-    } else {
-        elem = (rdn_elem *)data.data;
-        suffix_id = id_stored_to_internal(elem->rdn_elem_id);
-    }
-    dblayer_value_free(be, &data);
-    dblayer_value_free(be, &key);
-
     do {
         /* Setting up a key for the node to get its parent */
         keybuf = slapi_ch_smprintf("%c%u", RDN_INDEX_PARENT, workid);
@@ -1120,7 +1103,7 @@ entryrdn_lookup_dn(backend *be,
                     }
                     goto bail;
                 }
-                if (workid == suffix_id) {
+                if (workid == 1) {
                     /* The loop (workid) iterates from the starting 'id'
                      * up to the suffix ID (i.e. '1').
                      * A corner case (#6417) is if an entry, on the path
-- 
2.50.0

openSUSE Build Service is sponsored by