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

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