389-ds-base/0001-Issue-2526-retrocl-backend-created-out-of-order.patch
DistroBaker 9788aa4d18 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/389-ds-base.git#d9f3efb8f9f67cc8360f92669f3adce44ade4149
2020-10-30 02:30:32 +01:00

104 lines
3.8 KiB
Diff

From 67c8b8702a249cb0ef1ebf49b6e87056cd5339f6 Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Tue, 27 Oct 2020 13:14:55 -0400
Subject: [PATCH] Issue 2526 - retrocl backend created out of order
Bug Description: A recent change verified that you do not create
a mappingtree entry before the backend entry was
created. The server created the retrocl backend
in the opposite order which broke the retrocl.
Fix Description: Create the retrocl backend entry before creating
the mapping tree entry.
Relates: https://github.com/389ds/389-ds-base/issues/2526
Reviewed by: viktor(Thanks!)
---
ldap/servers/plugins/retrocl/retrocl.c | 10 ++---
ldap/servers/plugins/retrocl/retrocl_create.c | 38 +++++++++----------
2 files changed, 22 insertions(+), 26 deletions(-)
diff --git a/ldap/servers/plugins/retrocl/retrocl.c b/ldap/servers/plugins/retrocl/retrocl.c
index 4af4d752b..8d6135dad 100644
--- a/ldap/servers/plugins/retrocl/retrocl.c
+++ b/ldap/servers/plugins/retrocl/retrocl.c
@@ -222,15 +222,11 @@ retrocl_select_backend(void)
slapi_entry_free(referral);
if (err != LDAP_SUCCESS || be == NULL || be == defbackend_get_backend()) {
- slapi_log_err(SLAPI_LOG_ERR, RETROCL_PLUGIN_NAME,
+ /* Could not find the backend for cn=changelog, either because
+ * it doesn't exist mapping tree not registered. */
+ slapi_log_err(SLAPI_LOG_PLUGIN, RETROCL_PLUGIN_NAME,
"retrocl_select_backend - Mapping tree select failed (%d) %s.\n", err, errbuf);
-
- /* could not find the backend for cn=changelog, either because
- * it doesn't exist
- * mapping tree not registered.
- */
err = retrocl_create_config();
-
if (err != LDAP_SUCCESS)
return err;
} else {
diff --git a/ldap/servers/plugins/retrocl/retrocl_create.c b/ldap/servers/plugins/retrocl/retrocl_create.c
index fb1503520..571e6899f 100644
--- a/ldap/servers/plugins/retrocl/retrocl_create.c
+++ b/ldap/servers/plugins/retrocl/retrocl_create.c
@@ -192,6 +192,25 @@ retrocl_create_config(void)
vals[0] = &val;
vals[1] = NULL;
+ retrocl_be_changelog = slapi_be_select_by_instance_name("changelog");
+
+ if (retrocl_be_changelog == NULL) {
+ /* This is not the nsslapd-changelogdir from cn=changelog4,cn=config */
+ char *bedir;
+
+ bedir = retrocl_get_config_str(CONFIG_CHANGELOG_DIRECTORY_ATTRIBUTE);
+ if (bedir == NULL) {
+ /* none specified */
+ }
+
+ rc = retrocl_create_be(bedir);
+ slapi_ch_free_string(&bedir);
+ if (rc != LDAP_SUCCESS && rc != LDAP_ALREADY_EXISTS) {
+ return rc;
+ }
+ retrocl_be_changelog = slapi_be_select_by_instance_name("changelog");
+ }
+
/* Assume the mapping tree node is missing. It doesn't hurt to
* attempt to add it if it already exists. You will see a warning
* in the errors file when the referenced backend does not exist.
@@ -256,25 +275,6 @@ retrocl_create_config(void)
return rc;
}
- retrocl_be_changelog = slapi_be_select_by_instance_name("changelog");
-
- if (retrocl_be_changelog == NULL) {
- /* This is not the nsslapd-changelogdir from cn=changelog4,cn=config */
- char *bedir;
-
- bedir = retrocl_get_config_str(CONFIG_CHANGELOG_DIRECTORY_ATTRIBUTE);
- if (bedir == NULL) {
- /* none specified */
- }
-
- rc = retrocl_create_be(bedir);
- slapi_ch_free_string(&bedir);
- if (rc != LDAP_SUCCESS && rc != LDAP_ALREADY_EXISTS) {
- return rc;
- }
- retrocl_be_changelog = slapi_be_select_by_instance_name("changelog");
- }
-
return LDAP_SUCCESS;
}
--
2.28.0