andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
6d0b66
From b3170e39519530c39d59202413b20e6bd466224d Mon Sep 17 00:00:00 2001
6d0b66
From: James Chapman <jachapma@redhat.com>
6d0b66
Date: Wed, 27 Jan 2021 09:56:38 +0000
6d0b66
Subject: [PATCH 2/3] Issue 4396 - Minor memory leak in backend (#4558) (#4572)
6d0b66
6d0b66
Bug Description: As multiple suffixes per backend were no longer used, this
6d0b66
functionality has been replaced with a single suffix per backend. Legacy
6d0b66
code remains that adds multiple suffixes to the dse internal backend,
6d0b66
resulting in memory allocations that are lost.
6d0b66
6d0b66
Also a minor typo is corrected in backend.c
6d0b66
6d0b66
Fix Description: Calls to be_addsuffix on the DSE backend are removed
6d0b66
as they are never used.
6d0b66
6d0b66
Fixes: https://github.com/389ds/389-ds-base/issues/4396
6d0b66
6d0b66
Reviewed by: mreynolds389, Firstyear, droideck (Thank you)
6d0b66
---
6d0b66
 ldap/servers/slapd/backend.c |  2 +-
6d0b66
 ldap/servers/slapd/fedse.c   | 12 +++---------
6d0b66
 2 files changed, 4 insertions(+), 10 deletions(-)
6d0b66
6d0b66
diff --git a/ldap/servers/slapd/backend.c b/ldap/servers/slapd/backend.c
6d0b66
index bc52b4643..5707504a9 100644
6d0b66
--- a/ldap/servers/slapd/backend.c
6d0b66
+++ b/ldap/servers/slapd/backend.c
6d0b66
@@ -42,7 +42,7 @@ be_init(Slapi_Backend *be, const char *type, const char *name, int isprivate, in
6d0b66
     }
6d0b66
     be->be_monitordn = slapi_create_dn_string("cn=monitor,cn=%s,cn=%s,cn=plugins,cn=config",
6d0b66
                                               name, type);
6d0b66
-    if (NULL == be->be_configdn) {
6d0b66
+    if (NULL == be->be_monitordn) {
6d0b66
         slapi_log_err(SLAPI_LOG_ERR,
6d0b66
                       "be_init", "Failed create instance monitor dn for "
6d0b66
                                  "plugin %s, instance %s\n",
6d0b66
diff --git a/ldap/servers/slapd/fedse.c b/ldap/servers/slapd/fedse.c
6d0b66
index 0d645f909..7b820b540 100644
6d0b66
--- a/ldap/servers/slapd/fedse.c
6d0b66
+++ b/ldap/servers/slapd/fedse.c
6d0b66
@@ -2827,7 +2827,7 @@ search_snmp(Slapi_PBlock *pb __attribute__((unused)),
6d0b66
 }
6d0b66
 
6d0b66
 /*
6d0b66
- * Called from config.c to install the internal backends
6d0b66
+ * Called from main.c to install the internal backends
6d0b66
  */
6d0b66
 int
6d0b66
 setup_internal_backends(char *configdir)
6d0b66
@@ -2846,7 +2846,6 @@ 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
@@ -2895,16 +2894,11 @@ 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 = 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
+        be_new_internal(pfedse, "DSE", DSE_BACKEND, &fedse_plugin);
6d0b66
 
6d0b66
         /*
6d0b66
-         * Now that the be's are in place, we can
6d0b66
-         * setup the mapping tree.
6d0b66
+         * Now that the be's are in place, we can setup the mapping tree.
6d0b66
          */
6d0b66
-
6d0b66
         if (mapping_tree_init()) {
6d0b66
             slapi_log_err(SLAPI_LOG_EMERG, "setup_internal_backends", "Failed to init mapping tree\n");
6d0b66
             exit(1);
6d0b66
-- 
6d0b66
2.31.1
6d0b66