zrhoffman / rpms / 389-ds-base

Forked from rpms/389-ds-base 3 years ago
Clone

Blame SOURCES/0031-Ticket-49230-slapi_register_plugin-creates-config-en.patch

74ca47
From 91a162d66c2fe239c009f1ee16974d310b333e7e Mon Sep 17 00:00:00 2001
74ca47
From: Thierry Bordaz <tbordaz@redhat.com>
74ca47
Date: Fri, 21 Apr 2017 17:16:55 +0200
74ca47
Subject: [PATCH] Ticket 49230 - slapi_register_plugin creates config entry
74ca47
 where it should not
74ca47
74ca47
Bug Description:
74ca47
    slapi-register-plugin systematically create an entry under
74ca47
    'cn=plugins,cn=config' because it is not taking into account
74ca47
    the flag 'add_entry in 'plugin_setup'.
74ca47
74ca47
    This is potentially a regression introduced by
74ca47
    https://pagure.io/389-ds-base/issue/49066 (TBC)
74ca47
74ca47
Fix Description:
74ca47
    Test 'add_entry' before adding the entry
74ca47
74ca47
    https://pagure.io/389-ds-base/issue/49230
74ca47
74ca47
Review by: Mark Reynolds, William Brown
74ca47
---
74ca47
 ldap/servers/slapd/plugin.c | 12 +++++++-----
74ca47
 1 file changed, 7 insertions(+), 5 deletions(-)
74ca47
74ca47
diff --git a/ldap/servers/slapd/plugin.c b/ldap/servers/slapd/plugin.c
74ca47
index ac8306f..a5e0724 100644
74ca47
--- a/ldap/servers/slapd/plugin.c
74ca47
+++ b/ldap/servers/slapd/plugin.c
74ca47
@@ -3132,11 +3132,13 @@ plugin_setup(Slapi_Entry *plugin_entry, struct slapi_componentid *group,
74ca47
 		add_plugin_entry_dn(dn_copy);
74ca47
 	}
74ca47
 
74ca47
-    /* make a copy of the plugin entry for our own use because it will
74ca47
-       be freed later by the caller */
74ca47
-    Slapi_Entry *e_copy = slapi_entry_dup(plugin_entry);
74ca47
-    /* new_plugin_entry(&plugin_entries, plugin_entry, plugin); */
74ca47
-    new_plugin_entry(&dep_plugin_entries, e_copy, plugin);
74ca47
+	if (add_entry) {
74ca47
+		/* make a copy of the plugin entry for our own use because it will
74ca47
+		   be freed later by the caller */
74ca47
+		Slapi_Entry *e_copy = slapi_entry_dup(plugin_entry);
74ca47
+		/* new_plugin_entry(&plugin_entries, plugin_entry, plugin); */
74ca47
+		new_plugin_entry(&dep_plugin_entries, e_copy, plugin);
74ca47
+	}
74ca47
 
74ca47
 PLUGIN_CLEANUP:
74ca47
 	if (status) {
74ca47
-- 
74ca47
2.9.3
74ca47