6d0b66
From 8d06fdf44b0d337f1e321e61ee1b22972ddea917 Mon Sep 17 00:00:00 2001
6d0b66
From: tbordaz <tbordaz@redhat.com>
6d0b66
Date: Fri, 2 Apr 2021 14:05:41 +0200
6d0b66
Subject: [PATCH 3/3] Issue 4700 - Regression in winsync replication agreement
6d0b66
 (#4712)
6d0b66
6d0b66
Bug description:
6d0b66
	#4396 fixes a memory leak but did not set 'cn=config' as
6d0b66
	DSE backend.
6d0b66
	It had no signicant impact unless with sidgen IPA plugin
6d0b66
6d0b66
Fix description:
6d0b66
	revert the portion of the #4364 patch that set be_suffix
6d0b66
	in be_addsuffix, free the suffix before setting it
6d0b66
6d0b66
relates: https://github.com/389ds/389-ds-base/issues/4700
6d0b66
6d0b66
Reviewed by: Pierre Rogier (thanks !)
6d0b66
6d0b66
Platforms tested: F33
6d0b66
---
6d0b66
 ldap/servers/slapd/backend.c | 3 ++-
6d0b66
 ldap/servers/slapd/fedse.c   | 6 +++++-
6d0b66
 2 files changed, 7 insertions(+), 2 deletions(-)
6d0b66
6d0b66
diff --git a/ldap/servers/slapd/backend.c b/ldap/servers/slapd/backend.c
6d0b66
index 5707504a9..5db706841 100644
6d0b66
--- a/ldap/servers/slapd/backend.c
6d0b66
+++ b/ldap/servers/slapd/backend.c
6d0b66
@@ -173,7 +173,8 @@ void
6d0b66
 be_addsuffix(Slapi_Backend *be, const Slapi_DN *suffix)
6d0b66
 {
6d0b66
     if (be->be_state != BE_STATE_DELETED) {
6d0b66
-        be->be_suffix = slapi_sdn_dup(suffix);;
6d0b66
+        slapi_sdn_free(&be->be_suffix);
6d0b66
+        be->be_suffix = slapi_sdn_dup(suffix);
6d0b66
     }
6d0b66
 }
6d0b66
 
6d0b66
diff --git a/ldap/servers/slapd/fedse.c b/ldap/servers/slapd/fedse.c
6d0b66
index 7b820b540..44159c991 100644
6d0b66
--- a/ldap/servers/slapd/fedse.c
6d0b66
+++ b/ldap/servers/slapd/fedse.c
6d0b66
@@ -2846,6 +2846,7 @@ setup_internal_backends(char *configdir)
6d0b66
         Slapi_DN counters;
6d0b66
         Slapi_DN snmp;
6d0b66
         Slapi_DN root;
6d0b66
+        Slapi_Backend *be;
6d0b66
         Slapi_DN encryption;
6d0b66
         Slapi_DN saslmapping;
6d0b66
         Slapi_DN plugins;
6d0b66
@@ -2894,7 +2895,10 @@ setup_internal_backends(char *configdir)
6d0b66
         dse_register_callback(pfedse, SLAPI_OPERATION_ADD, DSE_FLAG_PREOP, &saslmapping, LDAP_SCOPE_SUBTREE, "(objectclass=nsSaslMapping)", sasl_map_config_add, NULL, NULL);
6d0b66
         dse_register_callback(pfedse, SLAPI_OPERATION_ADD, DSE_FLAG_PREOP, &plugins, LDAP_SCOPE_SUBTREE, "(objectclass=nsSlapdPlugin)", check_plugin_path, NULL, NULL);
6d0b66
 
6d0b66
-        be_new_internal(pfedse, "DSE", DSE_BACKEND, &fedse_plugin);
6d0b66
+        be = be_new_internal(pfedse, "DSE", DSE_BACKEND, &fedse_plugin);
6d0b66
+        be_addsuffix(be, &root);
6d0b66
+        be_addsuffix(be, &monitor);
6d0b66
+        be_addsuffix(be, &config);
6d0b66
 
6d0b66
         /*
6d0b66
          * Now that the be's are in place, we can setup the mapping tree.
6d0b66
-- 
6d0b66
2.31.1
6d0b66