Blame SOURCES/0064-Ticket-49257-only-register-modify-callbacks.patch

b69e47
From bbe3403a88f9adecbd5d4187ceeb080fb51d9d14 Mon Sep 17 00:00:00 2001
b69e47
From: Mark Reynolds <mreynolds@redhat.com>
b69e47
Date: Wed, 31 May 2017 11:15:13 -0400
b69e47
Subject: [PATCH] Ticket 49257 - only register modify callbacks
b69e47
b69e47
Bug Description:  Regression.  In the previous fix we called
b69e47
                  ldbm_instance_config_load_dse_info() to register all
b69e47
                  the dse preop callbacks.  Previously this was only done
b69e47
                  when creating an instance.  It was not designed to be
b69e47
                  used outside of that context, and it caused error 53's
b69e47
                  when trying to add a backend after instance creation.
b69e47
b69e47
Fix Description:  Just register the "modify" DSE preop callbacks.
b69e47
b69e47
https://pagure.io/389-ds-base/issue/49257
b69e47
b69e47
Reviewed by: ?
b69e47
b69e47
(cherry picked from commit 75a32a8829297a5cab303590d049f581740cf87e)
b69e47
---
b69e47
 ldap/servers/slapd/back-ldbm/instance.c             | 12 +++---------
b69e47
 ldap/servers/slapd/back-ldbm/ldbm_config.h          |  2 +-
b69e47
 ldap/servers/slapd/back-ldbm/ldbm_instance_config.c | 13 +++++++++++++
b69e47
 3 files changed, 17 insertions(+), 10 deletions(-)
b69e47
b69e47
diff --git a/ldap/servers/slapd/back-ldbm/instance.c b/ldap/servers/slapd/back-ldbm/instance.c
b69e47
index 8b38644..f067d22 100644
b69e47
--- a/ldap/servers/slapd/back-ldbm/instance.c
b69e47
+++ b/ldap/servers/slapd/back-ldbm/instance.c
b69e47
@@ -305,15 +305,9 @@ ldbm_instance_startall(struct ldbminfo *li)
b69e47
         if (rc1 != 0) {
b69e47
             rc = rc1;
b69e47
         } else {
b69e47
-            if(ldbm_instance_config_load_dse_info(inst) != 0){
b69e47
-                slapi_log_err(SLAPI_LOG_ERR, "ldbm_instance_startall",
b69e47
-                    "Loading database instance configuration failed for (%s)\n",
b69e47
-                    inst->inst_name);
b69e47
-                rc = -1;
b69e47
-            } else {
b69e47
-                vlv_init(inst);
b69e47
-                slapi_mtn_be_started(inst->inst_be);
b69e47
-            }
b69e47
+            ldbm_instance_register_modify_callback(inst);
b69e47
+            vlv_init(inst);
b69e47
+            slapi_mtn_be_started(inst->inst_be);
b69e47
         }
b69e47
         inst_obj = objset_next_obj(li->li_instance_set, inst_obj);
b69e47
     }
b69e47
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.h b/ldap/servers/slapd/back-ldbm/ldbm_config.h
b69e47
index ddec3a8..ea59739 100644
b69e47
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.h
b69e47
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.h
b69e47
@@ -157,6 +157,6 @@ int
b69e47
 ldbm_instance_index_config_enable_index(ldbm_instance *inst, Slapi_Entry* e);
b69e47
 int ldbm_instance_create_default_user_indexes(ldbm_instance *inst);
b69e47
 void ldbm_config_destroy(struct ldbminfo *li);
b69e47
-
b69e47
+void ldbm_instance_register_modify_callback(ldbm_instance *inst);
b69e47
 
b69e47
 #endif /* _LDBM_CONFIG_H_ */
b69e47
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
b69e47
index 49a6cac..8fb4119 100644
b69e47
--- a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
b69e47
+++ b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
b69e47
@@ -554,6 +554,19 @@ static int ldbm_instance_deny_config(Slapi_PBlock *pb, Slapi_Entry *e,
b69e47
     return SLAPI_DSE_CALLBACK_ERROR;
b69e47
 }
b69e47
 
b69e47
+void
b69e47
+ldbm_instance_register_modify_callback(ldbm_instance *inst)
b69e47
+{
b69e47
+    struct ldbminfo *li = inst->inst_li;
b69e47
+    char *dn = NULL;
b69e47
+
b69e47
+    dn = slapi_create_dn_string("cn=%s,cn=%s,cn=plugins,cn=config",
b69e47
+                                inst->inst_name, li->li_plugin->plg_name);
b69e47
+    slapi_config_register_callback(SLAPI_OPERATION_MODIFY, DSE_FLAG_PREOP, dn,
b69e47
+        LDAP_SCOPE_BASE, "(objectclass=*)",
b69e47
+        ldbm_instance_modify_config_entry_callback, (void *) inst);
b69e47
+    slapi_ch_free_string(&dn;;
b69e47
+}
b69e47
 /* Reads in any config information held in the dse for the given
b69e47
  * entry.  Creates dse entries used to configure the given instance
b69e47
  * if they don't already exist.  Registers dse callback functions to
b69e47
-- 
b69e47
2.9.5
b69e47