浏览代码

Revert "Ticket #111 - ability to control behavior of modifyTimestamp/modifiersName"

This reverts commit f7b882a8eebf62f15a7802ae4048c8153575d11e.
This is a partial revert.  We still want to keep the new config parameter,
we just don't want to have to change the plugins in any way.  We will
come up with a new mechanism for keeping track of the original requestor
DN, most likely a scheme using Thread Local Storage (TLS).
Rich Megginson 13 年之前
父节点
当前提交
9c0c0aa09d

+ 8 - 8
ldap/servers/plugins/automember/automember.c

@@ -103,8 +103,8 @@ static struct automemberRegexRule *automember_parse_regex_rule(char *rule_string
 static void automember_free_regex_rule(struct automemberRegexRule *rule);
 static int automember_parse_grouping_attr(char *value, char **grouping_attr,
     char **grouping_value);
-static void automember_update_membership(Slapi_PBlock *pb, struct configEntry *config, Slapi_Entry *e, void *txn);
-static void automember_add_member_value(Slapi_PBlock *pb, Slapi_Entry *member_e, const char *group_dn,
+static void automember_update_membership(struct configEntry *config, Slapi_Entry *e, void *txn);
+static void automember_add_member_value(Slapi_Entry *member_e, const char *group_dn,
     char *grouping_attr, char *grouping_value, void *txn);
 
 /*
@@ -1347,7 +1347,7 @@ automember_parse_grouping_attr(char *value, char **grouping_attr, char **groupin
  * the rules in config, then performs the updates.
  */
 static void
-automember_update_membership(Slapi_PBlock *pb, struct configEntry *config, Slapi_Entry *e, void *txn)
+automember_update_membership(struct configEntry *config, Slapi_Entry *e, void *txn)
 {
     PRCList *rule = NULL;
     struct automemberRegexRule *curr_rule = NULL;
@@ -1500,14 +1500,14 @@ automember_update_membership(Slapi_PBlock *pb, struct configEntry *config, Slapi
     if (PR_CLIST_IS_EMPTY(&targets)) {
         /* Add to each default group. */
         for (i = 0; config->default_groups && config->default_groups[i]; i++) {
-            automember_add_member_value(pb, e, config->default_groups[i],
+            automember_add_member_value(e, config->default_groups[i],
                                         config->grouping_attr, config->grouping_value, txn);
         }
     } else {
         /* Update the target groups. */
         dnitem = (struct automemberDNListItem *)PR_LIST_HEAD(&targets);
         while ((PRCList *)dnitem != &targets) {
-            automember_add_member_value(pb, e, slapi_sdn_get_dn(dnitem->dn),
+            automember_add_member_value(e, slapi_sdn_get_dn(dnitem->dn),
                                         config->grouping_attr, config->grouping_value, txn);
             dnitem = (struct automemberDNListItem *)PR_NEXT_LINK((PRCList *)dnitem);
         }
@@ -1535,10 +1535,10 @@ automember_update_membership(Slapi_PBlock *pb, struct configEntry *config, Slapi
  * Adds a member entry to a group.
  */
 static void
-automember_add_member_value(Slapi_PBlock *pb, Slapi_Entry *member_e, const char *group_dn,
+automember_add_member_value(Slapi_Entry *member_e, const char *group_dn,
                             char *grouping_attr, char *grouping_value, void *txn)
 {
-    Slapi_PBlock *mod_pb = slapi_pblock_new_by_pb(pb);
+    Slapi_PBlock *mod_pb = slapi_pblock_new();
     int result = LDAP_SUCCESS;
     LDAPMod mod;
     LDAPMod *mods[2];
@@ -1826,7 +1826,7 @@ automember_add_post_op(Slapi_PBlock *pb)
                 if (slapi_dn_issuffix(slapi_sdn_get_dn(sdn), config->scope) &&
                     (slapi_filter_test_simple(e, config->filter) == 0)) {
                     /* Find out what membership changes are needed and make them. */
-                    automember_update_membership(pb, config, e, txn);
+                    automember_update_membership(config, e, txn);
                 }
 
                 list = PR_NEXT_LINK(list);

+ 51 - 54
ldap/servers/plugins/dna/dna.c

@@ -216,7 +216,7 @@ static int dna_exop_init(Slapi_PBlock * pb);
  * Local operation functions
  *
  */
-static int dna_load_plugin_config(Slapi_PBlock *pb);
+static int dna_load_plugin_config();
 static int dna_parse_config_entry(Slapi_Entry * e, int apply);
 static void dna_delete_config();
 static void dna_free_config_entry(struct configEntry ** entry);
@@ -230,26 +230,26 @@ static int dna_load_host_port();
 static char *dna_get_dn(Slapi_PBlock * pb);
 static Slapi_DN *dna_get_sdn(Slapi_PBlock * pb);
 static int dna_dn_is_config(char *dn);
-static int dna_get_next_value(Slapi_PBlock *pb, struct configEntry * config_entry,
+static int dna_get_next_value(struct configEntry * config_entry,
                               char **next_value_ret, void *txn);
 static int dna_first_free_value(struct configEntry *config_entry,
                                 PRUint64 *newval, void *txn);
-static int dna_fix_maxval(Slapi_PBlock *pb, struct configEntry *config_entry, void *txn);
-static void dna_notice_allocation(Slapi_PBlock *pb, struct configEntry *config_entry,
+static int dna_fix_maxval(struct configEntry *config_entry, void *txn);
+static void dna_notice_allocation(struct configEntry *config_entry,
                                   PRUint64 new, PRUint64 last, int fix, void *txn);
-static int dna_update_shared_config(Slapi_PBlock *pb, struct configEntry * config_entry, void *txn);
+static int dna_update_shared_config(struct configEntry * config_entry, void *txn);
 static void dna_update_config_event(time_t event_time, void *arg);
 static int dna_get_shared_servers(struct configEntry *config_entry, PRCList **servers, void *txn);
 static void dna_free_shared_server(struct dnaServer **server);
 static void dna_delete_shared_servers(PRCList **servers);
-static int dna_release_range(Slapi_PBlock *pb, char *range_dn, PRUint64 *lower, PRUint64 *upper);
+static int dna_release_range(char *range_dn, PRUint64 *lower, PRUint64 *upper);
 static int dna_request_range(struct configEntry *config_entry,
                              struct dnaServer *server,
                              PRUint64 *lower, PRUint64 *upper);
 static struct berval *dna_create_range_request(char *range_dn);
-static int dna_update_next_range(Slapi_PBlock *pb, struct configEntry *config_entry,
+static int dna_update_next_range(struct configEntry *config_entry,
                                  PRUint64 lower, PRUint64 upper, void *txn);
-static int dna_activate_next_range(Slapi_PBlock *pb, struct configEntry *config_entry, void *txn);
+static int dna_activate_next_range(struct configEntry *config_entry, void *txn);
 static int dna_is_replica_bind_dn(char *range_dn, char *bind_dn);
 static int dna_get_replica_bind_creds(char *range_dn, struct dnaServer *server,
                                       char **bind_dn, char **bind_passwd,
@@ -589,7 +589,7 @@ dna_start(Slapi_PBlock * pb)
         slapi_ch_calloc(1, sizeof(struct configEntry));
     PR_INIT_CLIST(dna_global_config);
 
-    if (dna_load_plugin_config(pb) != DNA_SUCCESS) {
+    if (dna_load_plugin_config() != DNA_SUCCESS) {
         slapi_log_error(SLAPI_LOG_FATAL, DNA_PLUGIN_SUBSYSTEM,
                         "dna_start: unable to load plug-in configuration\n");
         return DNA_FAILURE;
@@ -657,7 +657,7 @@ done:
  * ------ cn=etc etc
  */
 static int
-dna_load_plugin_config(Slapi_PBlock *pb)
+dna_load_plugin_config()
 {
     int status = DNA_SUCCESS;
     int result;
@@ -665,14 +665,13 @@ dna_load_plugin_config(Slapi_PBlock *pb)
     time_t now;
     Slapi_PBlock *search_pb;
     Slapi_Entry **entries = NULL;
-    char *dn = NULL;
 
     slapi_log_error(SLAPI_LOG_TRACE, DNA_PLUGIN_SUBSYSTEM,
                     "--> dna_load_plugin_config\n");
 
     dna_write_lock();
     dna_delete_config();
-    slapi_pblock_get(pb, SLAPI_REQUESTOR_DN, &dn);
+
     search_pb = slapi_pblock_new();
 
     slapi_search_internal_set_pb(search_pb, getPluginDN(),
@@ -705,9 +704,8 @@ dna_load_plugin_config(Slapi_PBlock *pb)
      * performing the operation at this point when
      * starting up  would cause the change to not
      * get changelogged. */
-
     time(&now);
-    slapi_eq_once(dna_update_config_event, (void *)slapi_ch_strdup(dn), now + 30);
+    slapi_eq_once(dna_update_config_event, NULL, now + 30);
 
   cleanup:
     slapi_free_search_results_internal(search_pb);
@@ -1274,7 +1272,6 @@ dna_update_config_event(time_t event_time, void *arg)
     Slapi_PBlock *pb = NULL;
     struct configEntry *config_entry = NULL;
     PRCList *list = NULL;
-    char *binddn = (char *)arg;
 
     /* Get read lock to prevent config changes */
     dna_read_lock();
@@ -1291,11 +1288,9 @@ dna_update_config_event(time_t event_time, void *arg)
 
         /* Create the pblock.  We'll reuse this for all
          * shared config updates. */
-        if ((pb = slapi_pblock_new_by_pb(NULL)) == NULL)
+        if ((pb = slapi_pblock_new()) == NULL)
             goto bail;
 
-        slapi_pblock_set(pb, SLAPI_REQUESTOR_DN, binddn);
-
         while (list != dna_global_config) {
             config_entry = (struct configEntry *) list;
 
@@ -1313,7 +1308,7 @@ dna_update_config_event(time_t event_time, void *arg)
                 slapi_delete_internal_pb(pb);
 
                 /* Now force the entry to be recreated */
-                dna_update_shared_config(pb, config_entry, NULL);
+                dna_update_shared_config(config_entry, NULL);
 
                 slapi_unlock_mutex(config_entry->lock);
                 slapi_pblock_init(pb);
@@ -1325,7 +1320,6 @@ dna_update_config_event(time_t event_time, void *arg)
 
 bail:
     dna_unlock();
-    slapi_ch_free((void **)&binddn);
     slapi_pblock_destroy(pb);
 }
 
@@ -1342,7 +1336,7 @@ bail:
  * The lock for configEntry should be obtained
  * before calling this function.
  */
-static int dna_fix_maxval(Slapi_PBlock *pb, struct configEntry *config_entry, void *txn)
+static int dna_fix_maxval(struct configEntry *config_entry, void *txn)
 {
     PRCList *servers = NULL;
     PRCList *server = NULL;
@@ -1357,7 +1351,7 @@ static int dna_fix_maxval(Slapi_PBlock *pb, struct configEntry *config_entry, vo
     /* If we already have a next range we only need
      * to activate it. */
     if (config_entry->next_range_lower != 0) {
-        ret = dna_activate_next_range(pb, config_entry, txn);
+        ret = dna_activate_next_range(config_entry, txn);
         if (ret != 0) {
             slapi_log_error(SLAPI_LOG_FATAL, DNA_PLUGIN_SUBSYSTEM,
                             "dna_fix_maxval: Unable to activate the "
@@ -1381,7 +1375,7 @@ static int dna_fix_maxval(Slapi_PBlock *pb, struct configEntry *config_entry, vo
                 } else {
                     /* Someone provided us with a new range. Attempt 
                      * to update the config. */
-                    if ((ret = dna_update_next_range(pb, config_entry, lower, upper, txn)) == 0) {
+                    if ((ret = dna_update_next_range(config_entry, lower, upper, txn)) == 0) {
                         break;
                     }
                 }
@@ -1412,7 +1406,7 @@ bail:
  * The lock for configEntry should be obtained before calling
  * this function. */
 static void
-dna_notice_allocation(Slapi_PBlock *pb, struct configEntry *config_entry, PRUint64 new,
+dna_notice_allocation(struct configEntry *config_entry, PRUint64 new,
                       PRUint64 last, int fix, void *txn)
 {
     /* update our cached config entry */
@@ -1427,7 +1421,7 @@ dna_notice_allocation(Slapi_PBlock *pb, struct configEntry *config_entry, PRUint
          * new active range. */
         if (config_entry->next_range_lower != 0) {
             /* Make the next range active */
-            if (dna_activate_next_range(pb, config_entry, txn) != 0) {
+            if (dna_activate_next_range(config_entry, txn) != 0) {
                 slapi_log_error(SLAPI_LOG_FATAL, DNA_PLUGIN_SUBSYSTEM,
                                 "dna_notice_allocation: Unable to activate "
                                 "the next range for range %s.\n", config_entry->dn);
@@ -1435,7 +1429,7 @@ dna_notice_allocation(Slapi_PBlock *pb, struct configEntry *config_entry, PRUint
         } else {
             config_entry->remaining = 0;
             /* update the shared configuration */
-            dna_update_shared_config(pb, config_entry, txn);
+            dna_update_shared_config(config_entry, txn);
         }
     } else {
         if (config_entry->next_range_lower != 0) {
@@ -1448,7 +1442,7 @@ dna_notice_allocation(Slapi_PBlock *pb, struct configEntry *config_entry, PRUint
         }
 
         /* update the shared configuration */
-        dna_update_shared_config(pb, config_entry, txn);
+        dna_update_shared_config(config_entry, txn);
     }
 
     /* Check if we passed the threshold and try to fix maxval if so.  We
@@ -1460,7 +1454,7 @@ dna_notice_allocation(Slapi_PBlock *pb, struct configEntry *config_entry, PRUint
                         config_entry->threshold, config_entry->dn, config_entry->remaining);
         /* Only attempt to fix maxval if the fix flag is set. */
         if (fix != 0) {
-            dna_fix_maxval(pb, config_entry, txn);
+            dna_fix_maxval(config_entry, txn);
         }
     }
 
@@ -2059,7 +2053,7 @@ cleanup:
  * Perform ldap operationally atomic increment
  * Return the next value to be assigned
  */
-static int dna_get_next_value(Slapi_PBlock *origpb, struct configEntry *config_entry,
+static int dna_get_next_value(struct configEntry *config_entry,
                               char **next_value_ret, void *txn)
 {
     Slapi_PBlock *pb = NULL;
@@ -2085,7 +2079,7 @@ static int dna_get_next_value(Slapi_PBlock *origpb, struct configEntry *config_e
         /* check if we overflowed the configured range */
         if (setval > config_entry->maxval) {
             /* try for a new range or fail */
-            ret = dna_fix_maxval(pb, config_entry, txn);
+            ret = dna_fix_maxval(config_entry, txn);
             if (LDAP_SUCCESS != ret) {
                 slapi_log_error(SLAPI_LOG_FATAL, DNA_PLUGIN_SUBSYSTEM,
                                 "dna_get_next_value: no more values available!!\n");
@@ -2121,7 +2115,7 @@ static int dna_get_next_value(Slapi_PBlock *origpb, struct configEntry *config_e
         mods[0] = &mod_replace;
         mods[1] = 0;
 
-        pb = slapi_pblock_new_by_pb(origpb);
+        pb = slapi_pblock_new();
         if (NULL == pb) {
             ret = LDAP_OPERATIONS_ERROR;
             goto done;
@@ -2145,7 +2139,7 @@ static int dna_get_next_value(Slapi_PBlock *origpb, struct configEntry *config_e
         }
 
         /* update our cached config */
-        dna_notice_allocation(pb, config_entry, nextval, setval, 1, txn);
+        dna_notice_allocation(config_entry, nextval, setval, 1, txn);
     }
 
   done:
@@ -2171,7 +2165,7 @@ static int dna_get_next_value(Slapi_PBlock *origpb, struct configEntry *config_e
  * before calling this function.
  * */
 static int
-dna_update_shared_config(Slapi_PBlock *origpb, struct configEntry * config_entry, void *txn)
+dna_update_shared_config(struct configEntry * config_entry, void *txn)
 {
     int ret = LDAP_SUCCESS;
 
@@ -2197,7 +2191,7 @@ dna_update_shared_config(Slapi_PBlock *origpb, struct configEntry * config_entry
         mods[0] = &mod_replace;
         mods[1] = 0;
 
-        pb = slapi_pblock_new_by_pb(origpb);
+        pb = slapi_pblock_new();
         if (NULL == pb) {
             ret = LDAP_OPERATIONS_ERROR;
         } else {
@@ -2246,6 +2240,7 @@ dna_update_shared_config(Slapi_PBlock *origpb, struct configEntry * config_entry
             }
 
             slapi_pblock_destroy(pb);
+            pb = NULL;
         }
     }
 
@@ -2262,7 +2257,7 @@ dna_update_shared_config(Slapi_PBlock *origpb, struct configEntry * config_entry
  * before calling this function.
  */
 static int
-dna_update_next_range(Slapi_PBlock *origpb, struct configEntry *config_entry,
+dna_update_next_range(struct configEntry *config_entry,
                       PRUint64 lower, PRUint64 upper, void *txn)
 {
     Slapi_PBlock *pb = NULL;
@@ -2286,7 +2281,7 @@ dna_update_next_range(Slapi_PBlock *origpb, struct configEntry *config_entry,
     mods[0] = &mod_replace;
     mods[1] = 0;
 
-    pb = slapi_pblock_new_by_pb(origpb);
+    pb = slapi_pblock_new();
     if (NULL == pb) {
         ret = LDAP_OPERATIONS_ERROR;
         goto bail;
@@ -2300,6 +2295,7 @@ dna_update_next_range(Slapi_PBlock *origpb, struct configEntry *config_entry,
     slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &ret);
 
     slapi_pblock_destroy(pb);
+    pb = NULL;
 
     if (ret != LDAP_SUCCESS) {
         slapi_log_error(SLAPI_LOG_FATAL, DNA_PLUGIN_SUBSYSTEM,
@@ -2309,7 +2305,7 @@ dna_update_next_range(Slapi_PBlock *origpb, struct configEntry *config_entry,
         /* update the cached config and the shared config */
         config_entry->next_range_lower = lower;
         config_entry->next_range_upper = upper;
-        dna_notice_allocation(pb, config_entry, 0, 0, 0, txn);
+        dna_notice_allocation(config_entry, 0, 0, 0, txn);
     }
 
 bail:
@@ -2326,9 +2322,9 @@ bail:
  * be obtained before calling this function.
  */
 static int
-dna_activate_next_range(Slapi_PBlock *pb, struct configEntry *config_entry, void *txn)
+dna_activate_next_range(struct configEntry *config_entry, void *txn)
 {
-    Slapi_PBlock *mod_pb = NULL;
+    Slapi_PBlock *pb = NULL;
     LDAPMod mod_maxval;
     LDAPMod mod_nextval;
     LDAPMod mod_nextrange;
@@ -2367,20 +2363,21 @@ dna_activate_next_range(Slapi_PBlock *pb, struct configEntry *config_entry, void
     mods[3] = 0;
 
     /* Update the config entry first */
-    mod_pb = slapi_pblock_new_by_pb(pb);
-    if (NULL == mod_pb) {
+    pb = slapi_pblock_new();
+    if (NULL == pb) {
         ret = LDAP_OPERATIONS_ERROR;
         goto bail;
     }
 
-    slapi_modify_internal_set_pb(mod_pb, config_entry->dn,
+    slapi_modify_internal_set_pb(pb, config_entry->dn,
                                  mods, 0, 0, getPluginID(), 0);
-    slapi_pblock_set(mod_pb, SLAPI_TXN, txn);
-    slapi_modify_internal_pb(mod_pb);
+    slapi_pblock_set(pb, SLAPI_TXN, txn);
+    slapi_modify_internal_pb(pb);
 
-    slapi_pblock_get(mod_pb, SLAPI_PLUGIN_INTOP_RESULT, &ret);
+    slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &ret);
 
-    slapi_pblock_destroy(mod_pb);
+    slapi_pblock_destroy(pb);
+    pb = NULL;
 
     if (ret != LDAP_SUCCESS) {
         slapi_log_error(SLAPI_LOG_FATAL, DNA_PLUGIN_SUBSYSTEM,
@@ -2395,7 +2392,7 @@ dna_activate_next_range(Slapi_PBlock *pb, struct configEntry *config_entry, void
         config_entry->remaining = ((config_entry->maxval - config_entry->nextval + 1) /
                                     config_entry->interval);
         /* update the shared configuration */
-        dna_update_shared_config(pb, config_entry, txn);
+        dna_update_shared_config(config_entry, txn);
     }
 
 bail:
@@ -3105,7 +3102,7 @@ static int dna_pre_op(Slapi_PBlock * pb, int modtype)
                 int len;
 
                 /* create the value to add */
-                ret = dna_get_next_value(pb, config_entry, &value, txn);
+                ret = dna_get_next_value(config_entry, &value, txn);
                 if (DNA_SUCCESS != ret) {
                     errstr = slapi_ch_smprintf("Allocation of a new value for range"
                                                " %s failed! Unable to proceed.",
@@ -3229,7 +3226,7 @@ static int dna_config_check_post_op(Slapi_PBlock * pb)
 
     if ((dn = dna_get_dn(pb))) {
         if (dna_dn_is_config(dn))
-            dna_load_plugin_config(pb);
+            dna_load_plugin_config();
     }
 
     slapi_log_error(SLAPI_LOG_TRACE, DNA_PLUGIN_SUBSYSTEM,
@@ -3302,7 +3299,7 @@ static int dna_extend_exop(Slapi_PBlock *pb)
 
     /* See if we have the req. range configured.
      * If so, we need to see if we have range to provide. */
-    ret = dna_release_range(pb, shared_dn, &lower, &upper);
+    ret = dna_release_range(shared_dn, &lower, &upper);
 
     if (ret == LDAP_SUCCESS) {
         /* We have range to give away, so construct
@@ -3374,7 +3371,7 @@ static int dna_extend_exop(Slapi_PBlock *pb)
  * for the range specified by range_dn.
  */
 static int
-dna_release_range(Slapi_PBlock *origpb, char *range_dn, PRUint64 *lower, PRUint64 *upper)
+dna_release_range(char *range_dn, PRUint64 *lower, PRUint64 *upper)
 {
     int ret = 0;
     int match = 0;
@@ -3477,7 +3474,7 @@ dna_release_range(Slapi_PBlock *origpb, char *range_dn, PRUint64 *lower, PRUint6
                 *lower = *upper - release + 1;
 
                 /* Try to set the new next range in the config */
-                ret = dna_update_next_range(pb, config_entry, config_entry->next_range_lower,
+                ret = dna_update_next_range(config_entry, config_entry->next_range_lower,
                                             *lower - 1, NULL);
             } else {
                 /* We release up to half of our remaining values,
@@ -3507,7 +3504,7 @@ dna_release_range(Slapi_PBlock *origpb, char *range_dn, PRUint64 *lower, PRUint6
                 mods[0] = &mod_replace;
                 mods[1] = 0;
 
-                pb = slapi_pblock_new_by_pb(origpb);
+                pb = slapi_pblock_new();
                 if (NULL == pb) {
                     ret = LDAP_OPERATIONS_ERROR;
                     goto bail;
@@ -3525,7 +3522,7 @@ dna_release_range(Slapi_PBlock *origpb, char *range_dn, PRUint64 *lower, PRUint6
                 if (ret == LDAP_SUCCESS) {
                     /* Adjust maxval in our cached config and shared config */
                     config_entry->maxval = *lower - 1;
-                    dna_notice_allocation(pb, config_entry, config_entry->nextval, 0, 0, NULL);
+                    dna_notice_allocation(config_entry, config_entry->nextval, 0, 0, NULL);
                 }
             }
 

+ 8 - 14
ldap/servers/plugins/linkedattrs/fixup_task.c

@@ -48,7 +48,7 @@
  */
 static void linked_attrs_fixup_task_destructor(Slapi_Task *task);
 static void linked_attrs_fixup_task_thread(void *arg);
-static void linked_attrs_fixup_links(Slapi_PBlock *pb, struct configEntry *config, void *txn);
+static void linked_attrs_fixup_links(struct configEntry *config, void *txn);
 static int linked_attrs_remove_backlinks_callback(Slapi_Entry *e, void *callback_data);
 static int linked_attrs_add_backlinks_callback(Slapi_Entry *e, void *callback_data);
 static const char *fetch_attr(Slapi_Entry *e, const char *attrname,
@@ -91,7 +91,6 @@ linked_attrs_fixup_task_add(Slapi_PBlock *pb, Slapi_Entry *e,
 	if (linkdn) {
 	    mytaskdata->linkdn = slapi_dn_normalize(slapi_ch_strdup(linkdn));
 	}
-	mytaskdata->pb = pb;
 
 	/* allocate new task now */
 	task = slapi_new_task(slapi_entry_get_ndn(e));
@@ -140,12 +139,10 @@ linked_attrs_fixup_task_thread(void *arg)
 	Slapi_Task *task = (Slapi_Task *)arg;
 	task_data *td = NULL;
 	PRCList *main_config = NULL;
-	Slapi_PBlock *pb;
 	int found_config = 0;
 
 	/* Fetch our task data from the task */
 	td = (task_data *)slapi_task_get_data(task);
-	pb = slapi_pblock_new_by_pb(td->pb);
 
 	/* Log started message. */
 	slapi_task_begin(task, 1);
@@ -173,7 +170,7 @@ linked_attrs_fixup_task_thread(void *arg)
                     slapi_log_error(SLAPI_LOG_FATAL, LINK_PLUGIN_SUBSYSTEM,
                          "Fixing up linked attribute pair (%s)\n", config_entry->dn);
 
-                    linked_attrs_fixup_links(pb, config_entry, NULL);
+                    linked_attrs_fixup_links(config_entry, NULL);
                     break;
                 }
             } else {
@@ -183,7 +180,7 @@ linked_attrs_fixup_task_thread(void *arg)
                 slapi_log_error(SLAPI_LOG_FATAL, LINK_PLUGIN_SUBSYSTEM,
                        "Fixing up linked attribute pair (%s)\n", config_entry->dn);
 
-                linked_attrs_fixup_links(pb, config_entry, NULL);
+                linked_attrs_fixup_links(config_entry, NULL);
             }
 
             list = PR_NEXT_LINK(list);
@@ -208,27 +205,24 @@ linked_attrs_fixup_task_thread(void *arg)
 
 	/* this will queue the destruction of the task */
 	slapi_task_finish(task, rc);
-	slapi_pblock_destroy(pb);
 }
 
 struct fixup_cb_data {
     char *attrtype;
     void *txn;
     struct configEntry *config;
-    Slapi_PBlock *pb;
 };
 
 static void 
-linked_attrs_fixup_links(Slapi_PBlock *origpb, struct configEntry *config, void *txn)
+linked_attrs_fixup_links(struct configEntry *config, void *txn)
 {
-    Slapi_PBlock *pb = slapi_pblock_new_by_pb(origpb);
+    Slapi_PBlock *pb = slapi_pblock_new();
     char *del_filter = NULL;
     char *add_filter = NULL;
-    struct fixup_cb_data cb_data = {NULL, NULL, NULL, NULL};
+    struct fixup_cb_data cb_data = {NULL, NULL, NULL};
 
     del_filter = slapi_ch_smprintf("%s=*", config->managedtype);
     add_filter = slapi_ch_smprintf("%s=*", config->linktype);
-    cb_data.pb = pb;
 
     /* Lock the attribute pair. */
     slapi_lock_mutex(config->lock);
@@ -315,7 +309,7 @@ linked_attrs_remove_backlinks_callback(Slapi_Entry *e, void *callback_data)
     Slapi_DN *sdn = slapi_entry_get_sdn(e);
     struct fixup_cb_data *cb_data = (struct fixup_cb_data *)callback_data;
     char *type = cb_data->attrtype;
-    Slapi_PBlock *pb = slapi_pblock_new_by_pb(cb_data->pb);
+    Slapi_PBlock *pb = slapi_pblock_new();
     char *val[1];
     LDAPMod mod;
     LDAPMod *mods[2];
@@ -352,7 +346,7 @@ linked_attrs_add_backlinks_callback(Slapi_Entry *e, void *callback_data)
     char *linkdn = slapi_entry_get_dn(e);
     struct fixup_cb_data *cb_data = (struct fixup_cb_data *)callback_data;
     struct configEntry *config = cb_data->config;
-    Slapi_PBlock *pb = slapi_pblock_new_by_pb(cb_data->pb);
+    Slapi_PBlock *pb = slapi_pblock_new();
     int i = 0;
     char **targets = NULL;
     char *val[2];

+ 17 - 17
ldap/servers/plugins/linkedattrs/linked_attrs.c

@@ -106,13 +106,13 @@ static int linked_attrs_config_exists_reverse(struct configEntry *entry);
 static int linked_attrs_oktodo(Slapi_PBlock *pb);
 void linked_attrs_load_array(Slapi_Value **array, Slapi_Attr *attr);
 int linked_attrs_compare(const void *a, const void *b);
-static void linked_attrs_add_backpointers(Slapi_PBlock *pb, char *linkdn, struct configEntry *config,
+static void linked_attrs_add_backpointers(char *linkdn, struct configEntry *config,
     Slapi_Mod *smod, void *txn);
 static void linked_attrs_del_backpointers(Slapi_PBlock *pb, char *linkdn,
     struct configEntry *config, Slapi_Mod *smod);
 static void linked_attrs_replace_backpointers(Slapi_PBlock *pb, char *linkdn,
     struct configEntry *config, Slapi_Mod *smod);
-static void linked_attrs_mod_backpointers(Slapi_PBlock *pb, char *linkdn, char *type, char *scope,
+static void linked_attrs_mod_backpointers(char *linkdn, char *type, char *scope,
     int modop, Slapi_ValueSet *targetvals, void *txn);
 
 /*
@@ -1254,13 +1254,13 @@ linked_attrs_compare(const void *a, const void *b)
  * by the values in smod.
  */
 static void
-linked_attrs_add_backpointers(Slapi_PBlock *origpb, char *linkdn, struct configEntry *config,
+linked_attrs_add_backpointers(char *linkdn, struct configEntry *config,
     Slapi_Mod *smod, void *txn)
 {
     Slapi_ValueSet *vals = slapi_valueset_new();
 
     slapi_valueset_set_from_smod(vals, smod);
-    linked_attrs_mod_backpointers(origpb, linkdn, config->managedtype, config->scope,
+    linked_attrs_mod_backpointers(linkdn, config->managedtype, config->scope,
                                   LDAP_MOD_ADD, vals, txn);
 
     slapi_valueset_free(vals);
@@ -1295,7 +1295,7 @@ linked_attrs_del_backpointers(Slapi_PBlock *pb, char *linkdn,
     }
 
     slapi_pblock_get(pb, SLAPI_TXN, &txn);
-    linked_attrs_mod_backpointers(pb,linkdn, config->managedtype, config->scope,
+    linked_attrs_mod_backpointers(linkdn, config->managedtype, config->scope,
                                   LDAP_MOD_DELETE, vals, txn);
 
     slapi_valueset_free(vals);
@@ -1414,13 +1414,13 @@ linked_attrs_replace_backpointers(Slapi_PBlock *pb, char *linkdn,
 
         /* Perform the actual updates to the target entries. */
         if (delvals) {
-            linked_attrs_mod_backpointers(pb, linkdn, config->managedtype,
+            linked_attrs_mod_backpointers(linkdn, config->managedtype,
                                           config->scope, LDAP_MOD_DELETE, delvals, txn);
             slapi_valueset_free(delvals);
         }
 
         if (addvals) {
-            linked_attrs_mod_backpointers(pb, linkdn, config->managedtype,
+            linked_attrs_mod_backpointers(linkdn, config->managedtype,
                                           config->scope, LDAP_MOD_ADD, addvals, txn);
             slapi_valueset_free(addvals);
         }
@@ -1436,12 +1436,12 @@ linked_attrs_replace_backpointers(Slapi_PBlock *pb, char *linkdn,
  * Performs backpointer management.
  */
 static void
-linked_attrs_mod_backpointers(Slapi_PBlock *origpb, char *linkdn, char *type,
+linked_attrs_mod_backpointers(char *linkdn, char *type,
     char *scope, int modop, Slapi_ValueSet *targetvals, void *txn)
 {
     char *val[2];
     int i = 0;
-    Slapi_PBlock *mod_pb = slapi_pblock_new_by_pb(origpb);
+    Slapi_PBlock *mod_pb = slapi_pblock_new();
     LDAPMod mod;
     LDAPMod *mods[2];
     Slapi_Value *targetval = NULL;
@@ -1684,7 +1684,7 @@ linked_attrs_mod_post_op(Slapi_PBlock *pb)
                 case LDAP_MOD_ADD:
                     /* Find the entries pointed to by the new
                      * values and add the backpointers. */
-                    linked_attrs_add_backpointers(pb, dn, config, smod, txn);
+                    linked_attrs_add_backpointers(dn, config, smod, txn);
                     break;
                 case LDAP_MOD_DELETE:
                     /* Find the entries pointed to by the deleted
@@ -1779,7 +1779,7 @@ linked_attrs_add_post_op(Slapi_PBlock *pb)
 
                 slapi_lock_mutex(config->lock);
 
-                linked_attrs_mod_backpointers(pb, dn, config->managedtype,
+                linked_attrs_mod_backpointers(dn, config->managedtype,
                                               config->scope, LDAP_MOD_ADD, vals, txn);
 
                 slapi_unlock_mutex(config->lock);
@@ -1860,7 +1860,7 @@ linked_attrs_del_post_op(Slapi_PBlock *pb)
 
                 slapi_lock_mutex(config->lock);
 
-                linked_attrs_mod_backpointers(pb, dn, config->managedtype,
+                linked_attrs_mod_backpointers(dn, config->managedtype,
                                               config->scope, LDAP_MOD_DELETE, vals, txn);
 
                 slapi_unlock_mutex(config->lock);
@@ -1889,7 +1889,7 @@ linked_attrs_del_post_op(Slapi_PBlock *pb)
                         slapi_lock_mutex(config->lock);
 
                         /* Delete forward link value. */
-                        linked_attrs_mod_backpointers(pb, dn, config->linktype,
+                        linked_attrs_mod_backpointers(dn, config->linktype,
                                                       config->scope, LDAP_MOD_DELETE, vals, txn);
 
                         slapi_unlock_mutex(config->lock);
@@ -1990,7 +1990,7 @@ linked_attrs_modrdn_post_op(Slapi_PBlock *pb)
             slapi_lock_mutex(config->lock);
 
             /* Delete old dn value. */
-            linked_attrs_mod_backpointers(pb, old_dn, config->managedtype,
+            linked_attrs_mod_backpointers(old_dn, config->managedtype,
                                           config->scope, LDAP_MOD_DELETE, vals, txn);
 
             slapi_unlock_mutex(config->lock);
@@ -2013,7 +2013,7 @@ linked_attrs_modrdn_post_op(Slapi_PBlock *pb)
             slapi_lock_mutex(config->lock);
 
             /* Add new dn value. */
-            linked_attrs_mod_backpointers(pb, new_dn, config->managedtype,
+            linked_attrs_mod_backpointers(new_dn, config->managedtype,
                                           config->scope, LDAP_MOD_ADD, vals, txn);
 
             slapi_unlock_mutex(config->lock);
@@ -2042,11 +2042,11 @@ linked_attrs_modrdn_post_op(Slapi_PBlock *pb)
                     slapi_lock_mutex(config->lock);
 
                     /* Delete old dn value. */
-                    linked_attrs_mod_backpointers(pb, old_dn, config->linktype,
+                    linked_attrs_mod_backpointers(old_dn, config->linktype,
                                                   config->scope, LDAP_MOD_DELETE, vals, txn);
 
                     /* Add new dn value. */
-                    linked_attrs_mod_backpointers(pb, new_dn, config->linktype,
+                    linked_attrs_mod_backpointers(new_dn, config->linktype,
                                                   config->scope, LDAP_MOD_ADD, vals, txn);
 
                     slapi_unlock_mutex(config->lock);

+ 0 - 1
ldap/servers/plugins/linkedattrs/linked_attrs.h

@@ -100,7 +100,6 @@ struct configIndex {
 typedef struct _task_data
 {
     char *linkdn;
-    Slapi_PBlock *pb;
 } task_data;
 
 

+ 19 - 32
ldap/servers/plugins/memberof/memberof.c

@@ -92,7 +92,6 @@ typedef struct _memberof_get_groups_data
         MemberOfConfig *config;
         Slapi_Value *memberdn_val;
         Slapi_ValueSet **groupvals;
-        Slapi_PBlock *pb;
         void *txn;
 } memberof_get_groups_data;
 
@@ -149,7 +148,7 @@ static int memberof_call_foreach_dn(Slapi_PBlock *pb, char *dn,
 static int memberof_is_direct_member(MemberOfConfig *config, Slapi_Value *groupdn,
 	Slapi_Value *memberdn, void *txn);
 static int memberof_is_grouping_attr(char *type, MemberOfConfig *config);
-static Slapi_ValueSet *memberof_get_groups(Slapi_PBlock *pb, MemberOfConfig *config, char *memberdn, void *txn);
+static Slapi_ValueSet *memberof_get_groups(MemberOfConfig *config, char *memberdn, void *txn);
 static int memberof_get_groups_r(MemberOfConfig *config, char *memberdn,
 	memberof_get_groups_data *data, void *txn);
 static int memberof_get_groups_callback(Slapi_Entry *e, void *callback_data);
@@ -170,7 +169,7 @@ static void memberof_task_destructor(Slapi_Task *task);
 static const char *fetch_attr(Slapi_Entry *e, const char *attrname,
                                               const char *default_val);
 static void memberof_fixup_task_thread(void *arg);
-static int memberof_fix_memberof(Slapi_PBlock *pb, MemberOfConfig *config, char *dn, char *filter_str, void *txn);
+static int memberof_fix_memberof(MemberOfConfig *config, char *dn, char *filter_str, void *txn);
 static int memberof_fix_memberof_callback(Slapi_Entry *e, void *callback_data);
 
 
@@ -449,7 +448,6 @@ int memberof_postop_del(Slapi_PBlock *pb)
 
 typedef struct _memberof_del_dn_data
 {
-	Slapi_PBlock *pb;
 	char *dn;
 	char *type;
 	void *txn;
@@ -467,7 +465,7 @@ memberof_del_dn_from_groups(Slapi_PBlock *pb, MemberOfConfig *config, char *dn,
 	 * same grouping attribute. */
 	for (i = 0; config->groupattrs[i]; i++)
 	{
-		memberof_del_dn_data data = {pb, dn, config->groupattrs[i], txn};
+		memberof_del_dn_data data = {dn, config->groupattrs[i], txn};
 
 		groupattrs[0] = config->groupattrs[i];
 
@@ -484,7 +482,7 @@ int memberof_del_dn_type_callback(Slapi_Entry *e, void *callback_data)
 	char *val[2];
 	Slapi_PBlock *mod_pb = 0;
 
-	mod_pb = slapi_pblock_new_by_pb(((memberof_del_dn_data *)callback_data)->pb);
+	mod_pb = slapi_pblock_new();
 
 	mods[0] = &mod;
 	mods[1] = 0;
@@ -523,7 +521,7 @@ int memberof_call_foreach_dn(Slapi_PBlock *pb, char *dn,
 	char **types, plugin_search_entry_callback callback, void *callback_data, void *txn)
 {
 	int rc = 0;
-	Slapi_PBlock *search_pb = slapi_pblock_new_by_pb(pb);
+	Slapi_PBlock *search_pb = slapi_pblock_new();
 	Slapi_Backend *be = 0;
 	Slapi_DN *sdn = 0;
 	Slapi_DN *base_sdn = 0;
@@ -695,7 +693,6 @@ int memberof_postop_modrdn(Slapi_PBlock *pb)
 
 typedef struct _replace_dn_data
 {
-	Slapi_PBlock *pb;
 	char *pre_dn;
 	char *post_dn;
 	char *type;
@@ -717,7 +714,7 @@ memberof_replace_dn_from_groups(Slapi_PBlock *pb, MemberOfConfig *config,
 	 * using the same grouping attribute. */
 	for (i = 0; config->groupattrs[i]; i++)
 	{
-		replace_dn_data data = {pb, pre_dn, post_dn, config->groupattrs[i], txn};
+		replace_dn_data data = {pre_dn, post_dn, config->groupattrs[i], txn};
 
 		groupattrs[0] = config->groupattrs[i];
 
@@ -737,7 +734,7 @@ int memberof_replace_dn_type_callback(Slapi_Entry *e, void *callback_data)
 	char *addval[2];
 	Slapi_PBlock *mod_pb = 0;
 
-	mod_pb = slapi_pblock_new_by_pb(((replace_dn_data *)callback_data)->pb);
+	mod_pb = slapi_pblock_new();
 
 	mods[0] = &delmod;
 	mods[1] = &addmod;
@@ -1094,7 +1091,6 @@ int memberof_modop_one_r(Slapi_PBlock *pb, MemberOfConfig *config, int mod_op,
 }
 
 struct fix_memberof_callback_data {
-	Slapi_PBlock *pb;
 	MemberOfConfig *config;
 	void *txn;
 };
@@ -1313,11 +1309,11 @@ int memberof_modop_one_replace_r(Slapi_PBlock *pb, MemberOfConfig *config,
 		if(LDAP_MOD_DELETE == mod_op || LDAP_MOD_ADD == mod_op)
 		{
 			/* find parent groups and replace our member attr */
-			struct fix_memberof_callback_data cb_data = {pb, config, txn};
+			struct fix_memberof_callback_data cb_data = {config, txn};
 			memberof_fix_memberof_callback(e, &cb_data);
 		} else {
 			/* single entry - do mod */
-			mod_pb = slapi_pblock_new_by_pb(pb);
+			mod_pb = slapi_pblock_new();
 
 			mods[0] = &mod;
 			if(LDAP_MOD_REPLACE == mod_op)
@@ -1645,11 +1641,11 @@ int memberof_moddn_attr_list(Slapi_PBlock *pb, MemberOfConfig *config,
  * A Slapi_ValueSet* is returned.  It is up to the caller to
  * free it.
  */
-Slapi_ValueSet *memberof_get_groups(Slapi_PBlock *pb, MemberOfConfig *config, char *memberdn, void *txn)
+Slapi_ValueSet *memberof_get_groups(MemberOfConfig *config, char *memberdn, void *txn)
 {
 	Slapi_Value *memberdn_val = slapi_value_new_string(memberdn);
 	Slapi_ValueSet *groupvals = slapi_valueset_new();
-	memberof_get_groups_data data = {config, memberdn_val, &groupvals, pb, txn};
+	memberof_get_groups_data data = {config, memberdn_val, &groupvals, txn};
 
 	memberof_get_groups_r(config, memberdn, &data, txn);
 
@@ -1662,7 +1658,7 @@ int memberof_get_groups_r(MemberOfConfig *config, char *memberdn, memberof_get_g
 {
 	/* Search for any grouping attributes that point to memberdn.
 	 * For each match, add it to the list, recurse and do same search */
-	return memberof_call_foreach_dn(data->pb, memberdn, config->groupattrs,
+	return memberof_call_foreach_dn(NULL, memberdn, config->groupattrs,
 		memberof_get_groups_callback, data, txn);
 }
 
@@ -2228,7 +2224,6 @@ typedef struct _task_data
 {
 	char *dn;
 	char *filter_str;
-	char *binddn;
 } task_data;
 
 void memberof_fixup_task_thread(void *arg)
@@ -2236,14 +2231,11 @@ void memberof_fixup_task_thread(void *arg)
 	MemberOfConfig configCopy = {0, 0, 0, 0};
 	Slapi_Task *task = (Slapi_Task *)arg;
 	task_data *td = NULL;
-	Slapi_PBlock *pb = slapi_pblock_new_by_pb(NULL);
 	int rc = 0;
 
 	/* Fetch our task data from the task */
 	td = (task_data *)slapi_task_get_data(task);
 
-	/* construct our pblock for plugin bind tracking */
-	slapi_pblock_set(pb, SLAPI_REQUESTOR_DN, td->binddn);
 	slapi_task_begin(task, 1);
 	slapi_task_log_notice(task, "Memberof task starts (arg: %s) ...\n", 
 								td->filter_str);
@@ -2260,7 +2252,7 @@ void memberof_fixup_task_thread(void *arg)
 	memberof_lock();
 
 	/* do real work */
-	rc = memberof_fix_memberof(pb, &configCopy, td->dn, td->filter_str, NULL /* no txn? */);
+	rc = memberof_fix_memberof(&configCopy, td->dn, td->filter_str, NULL /* no txn? */);
  
 	/* release the memberOf operation lock */
 	memberof_unlock();
@@ -2270,7 +2262,6 @@ void memberof_fixup_task_thread(void *arg)
 	slapi_task_log_notice(task, "Memberof task finished.");
 	slapi_task_log_status(task, "Memberof task finished.");
 	slapi_task_inc_progress(task);
-	slapi_pblock_destroy(pb);
 
 	/* this will queue the destruction of the task */
 	slapi_task_finish(task, rc);
@@ -2339,9 +2330,6 @@ int memberof_task_add(Slapi_PBlock *pb, Slapi_Entry *e,
 	mytaskdata->dn = slapi_ch_strdup(dn);
 	mytaskdata->filter_str = slapi_ch_strdup(filter);
 
-	slapi_pblock_get(pb,SLAPI_REQUESTOR_DN, &dn);
-	mytaskdata->binddn = slapi_ch_strdup(dn);
-
 	/* allocate new task now */
 	task = slapi_new_task(slapi_entry_get_ndn(e));
 
@@ -2378,18 +2366,17 @@ memberof_task_destructor(Slapi_Task *task)
 		if (mydata) {
 			slapi_ch_free_string(&mydata->dn);
 			slapi_ch_free_string(&mydata->filter_str);
-			slapi_ch_free_string(&mydata->binddn);
 			/* Need to cast to avoid a compiler warning */
 			slapi_ch_free((void **)&mydata);
 		}
 	}
 }
 
-int memberof_fix_memberof(Slapi_PBlock *pb, MemberOfConfig *config, char *dn, char *filter_str, void *txn)
+int memberof_fix_memberof(MemberOfConfig *config, char *dn, char *filter_str, void *txn)
 {
 	int rc = 0;
-	struct fix_memberof_callback_data cb_data = {pb, config, txn};
-	Slapi_PBlock *search_pb = slapi_pblock_new_by_pb(pb);
+	struct fix_memberof_callback_data cb_data = {config, txn};
+	Slapi_PBlock *search_pb = slapi_pblock_new();
 
 	slapi_search_internal_set_pb(search_pb, dn,
 		LDAP_SCOPE_SUBTREE, filter_str, 0, 0,
@@ -2422,17 +2409,17 @@ int memberof_fix_memberof_callback(Slapi_Entry *e, void *callback_data)
 	Slapi_DN *sdn = slapi_entry_get_sdn(e);
 	struct fix_memberof_callback_data *cb_data = (struct fix_memberof_callback_data *)callback_data;
 	MemberOfConfig *config = cb_data->config;
-	memberof_del_dn_data del_data = {cb_data->pb, 0, config->memberof_attr, cb_data->txn};
+	memberof_del_dn_data del_data = {0, config->memberof_attr, cb_data->txn};
 	Slapi_ValueSet *groups = 0;
 
 	/* get a list of all of the groups this user belongs to */
-	groups = memberof_get_groups(cb_data->pb, config, dn, cb_data->txn);
+	groups = memberof_get_groups(config, dn, cb_data->txn);
 
 	/* If we found some groups, replace the existing memberOf attribute
 	 * with the found values.  */
 	if (groups && slapi_valueset_count(groups))
 	{
-		Slapi_PBlock *mod_pb = slapi_pblock_new_by_pb(cb_data->pb);
+		Slapi_PBlock *mod_pb = slapi_pblock_new();
 		Slapi_Value *val = 0;
 		Slapi_Mod *smod;
 		LDAPMod **mods = (LDAPMod **) slapi_ch_malloc(2 * sizeof(LDAPMod *));

+ 12 - 12
ldap/servers/plugins/mep/mep.c

@@ -107,9 +107,9 @@ static int mep_oktodo(Slapi_PBlock *pb);
 static int mep_isrepl(Slapi_PBlock *pb);
 static Slapi_Entry *mep_create_managed_entry(struct configEntry *config,
     Slapi_Entry *origin);
-static void mep_add_managed_entry(Slapi_PBlock *pb, struct configEntry *config,
+static void mep_add_managed_entry(struct configEntry *config,
     Slapi_Entry *origin, void *txn);
-static void mep_rename_managed_entry(Slapi_PBlock *pb, Slapi_Entry *origin,
+static void mep_rename_managed_entry(Slapi_Entry *origin,
     Slapi_DN *new_dn, Slapi_DN *old_dn, void *txn);
 static Slapi_Mods *mep_get_mapped_mods(struct configEntry *config,
     Slapi_Entry *origin, char **mapped_dn);
@@ -1422,12 +1422,12 @@ mep_create_managed_entry(struct configEntry *config, Slapi_Entry *origin)
  * newly created managed entry.
  */
 static void
-mep_add_managed_entry(Slapi_PBlock *pb, struct configEntry *config,
+mep_add_managed_entry(struct configEntry *config,
     Slapi_Entry *origin, void *txn)
 {
     Slapi_Entry *managed_entry = NULL;
     char *managed_dn = NULL;
-    Slapi_PBlock *mod_pb = slapi_pblock_new_by_pb(pb);
+    Slapi_PBlock *mod_pb = slapi_pblock_new();
     int result = LDAP_SUCCESS;
 
     /* Create the managed entry */
@@ -1523,11 +1523,11 @@ mep_add_managed_entry(Slapi_PBlock *pb, struct configEntry *config,
  * origin entry.
  */
 static void
-mep_rename_managed_entry(Slapi_PBlock *pb, Slapi_Entry *origin,
+mep_rename_managed_entry(Slapi_Entry *origin,
                          Slapi_DN *new_dn, Slapi_DN *old_dn, void *txn)
 {
     Slapi_RDN *srdn = slapi_rdn_new();
-    Slapi_PBlock *mep_pb = slapi_pblock_new_by_pb(pb);
+    Slapi_PBlock *mep_pb = slapi_pblock_new();
     LDAPMod mod;
     LDAPMod *mods[2];
     char *vals[2];
@@ -2392,7 +2392,7 @@ mep_mod_post_op(Slapi_PBlock *pb)
                 smods = mep_get_mapped_mods(config, e, &mapped_dn);
                 if (smods) {
                     /* Clear out the pblock for reuse. */
-                    mep_pb = slapi_pblock_new_by_pb(pb);
+                    mep_pb = slapi_pblock_new();
 
                     /* Perform the modify operation. */
                     slapi_log_error(SLAPI_LOG_PLUGIN, MEP_PLUGIN_SUBSYSTEM,
@@ -2423,7 +2423,7 @@ mep_mod_post_op(Slapi_PBlock *pb)
                     managed_sdn = slapi_sdn_new_normdn_byref(managed_dn);
 
                     if (slapi_sdn_compare(managed_sdn, mapped_sdn) != 0) {
-                        mep_rename_managed_entry(pb, e, mapped_sdn, managed_sdn, txn);
+                        mep_rename_managed_entry(e, mapped_sdn, managed_sdn, txn);
                     }
 
                     slapi_sdn_free(&mapped_sdn);
@@ -2499,7 +2499,7 @@ mep_add_post_op(Slapi_PBlock *pb)
 
         mep_find_config(e, &config);
         if (config) {
-            mep_add_managed_entry(pb, config, e, txn);
+            mep_add_managed_entry(config, e, txn);
         }
 
         mep_config_unlock();
@@ -2646,7 +2646,7 @@ mep_modrdn_post_op(Slapi_PBlock *pb)
         LDAPMod *mods[3];
         char *vals[2];
         int result = LDAP_SUCCESS;
-        Slapi_PBlock *mep_pb = slapi_pblock_new_by_pb(pb);
+        Slapi_PBlock *mep_pb = slapi_pblock_new();
         Slapi_Entry *new_managed_entry = NULL;
         Slapi_DN *managed_sdn = NULL;
         Slapi_Mods *smods = NULL;
@@ -2775,7 +2775,7 @@ mep_modrdn_post_op(Slapi_PBlock *pb)
                                     "entry \"%s\".\n ", managed_dn,
                                     slapi_entry_get_dn(new_managed_entry),
                                     slapi_sdn_get_dn(old_sdn));
-                    mep_rename_managed_entry(pb, post_e,
+                    mep_rename_managed_entry(post_e,
                                     slapi_entry_get_sdn(new_managed_entry),
                                     managed_sdn, txn);
                 }
@@ -2838,7 +2838,7 @@ bailmod:
 
         mep_find_config(post_e, &config);
         if (config) {
-            mep_add_managed_entry(pb, config, post_e, txn);
+            mep_add_managed_entry(config, post_e, txn);
         }
 
         mep_config_unlock();

+ 26 - 31
ldap/servers/plugins/referint/referint.c

@@ -77,10 +77,10 @@ int referint_postop_del( Slapi_PBlock *pb );
 int referint_postop_modrdn( Slapi_PBlock *pb ); 
 int referint_postop_start( Slapi_PBlock *pb);
 int referint_postop_close( Slapi_PBlock *pb);
-int update_integrity(Slapi_PBlock *pb, char **argv, Slapi_DN *sDN, char *newrDN, Slapi_DN *newsuperior, int logChanges, void *txn);
+int update_integrity(char **argv, Slapi_DN *sDN, char *newrDN, Slapi_DN *newsuperior, int logChanges, void *txn);
 void referint_thread_func(void *arg);
 int  GetNextLine(char *dest, int size_dest, PRFileDesc *stream);
-void writeintegritylog(Slapi_PBlock *pb, char *logfilename, Slapi_DN *sdn, char *newrdn, Slapi_DN *newsuperior);
+void writeintegritylog(char *logfilename, Slapi_DN *sdn, char *newrdn, Slapi_DN *newsuperior, Slapi_DN *requestorsdn);
 int my_fgetc(PRFileDesc *stream);
 
 /* global thread control stuff */
@@ -215,10 +215,10 @@ referint_postop_del( Slapi_PBlock *pb )
 		}else if(delay == 0){
 		  /* no delay */
  		  /* call function to update references to entry */
-		  rc = update_integrity(pb, argv, sdn, NULL, NULL, logChanges, txn);
+		  rc = update_integrity(argv, sdn, NULL, NULL, logChanges, txn);
 		}else{
 		  /* write the entry to integrity log */
-		  writeintegritylog(pb, argv[1], sdn, NULL, NULL);
+		  writeintegritylog(argv[1], sdn, NULL, NULL, NULL /* slapi_get_requestor_sdn(pb) */);
 		  rc = 0;
 		}
 	} else {
@@ -300,11 +300,11 @@ referint_postop_modrdn( Slapi_PBlock *pb )
 	}else if(delay == 0){
 	  /* no delay */
 	  /* call function to update references to entry */
-	  rc = update_integrity(pb, argv, sdn, newrdn,
+	  rc = update_integrity(argv, sdn, newrdn,
 	                        newsuperior, logChanges, txn);
 	}else{
 	  /* write the entry to integrity log */
-	  writeintegritylog(pb, argv[1], sdn, newrdn, newsuperior);
+	  writeintegritylog(argv[1], sdn, newrdn, newsuperior, NULL /* slapi_get_requestor_sdn(pb) */);
 	  rc = 0;
 	}
 
@@ -674,12 +674,12 @@ bail:
 }
 
 int
-update_integrity(Slapi_PBlock *pb, char **argv, Slapi_DN *origSDN,
+update_integrity(char **argv, Slapi_DN *origSDN,
                  char *newrDN, Slapi_DN *newsuperior, 
                  int logChanges, void *txn)
 {
     Slapi_PBlock *search_result_pb = NULL;
-    Slapi_PBlock *mod_pb = slapi_pblock_new_by_pb(pb);
+    Slapi_PBlock *mod_pb = slapi_pblock_new();
     Slapi_Entry  **search_entries = NULL;
     int search_result;
     Slapi_DN *sdn = NULL;
@@ -912,15 +912,12 @@ referint_thread_func(void *arg)
 	Slapi_DN *sdn = NULL;
     char *tmprdn;
     Slapi_DN *tmpsuperior = NULL;
-    Slapi_DN *binddn = NULL;
     int logChanges=0;
 	char * iter = NULL;
-	Slapi_PBlock *pb = slapi_pblock_new_by_pb(NULL);
 
     if(plugin_argv == NULL){
       slapi_log_error( SLAPI_LOG_FATAL, REFERINT_PLUGIN_SUBSYSTEM,
 		 "referint_thread_func not get args \n" );
-      slapi_pblock_destroy(pb);
       return;
     }
 
@@ -975,7 +972,6 @@ referint_thread_func(void *arg)
 	while( GetNextLine(thisline, MAX_LINE, prfd) ){
 	    ptoken = ldap_utf8strtok_r(thisline, delimiter, &iter);
 		sdn = slapi_sdn_new_normdn_byref(ptoken);
-		slapi_pblock_init(pb);
 
 	    ptoken = ldap_utf8strtok_r (NULL, delimiter, &iter);
 	    if(!strcasecmp(ptoken, "NULL")) {
@@ -990,16 +986,8 @@ referint_thread_func(void *arg)
 	    } else {
 	        tmpsuperior = slapi_sdn_new_normdn_byref(ptoken);
 	    }
-
-	    /* this should be the bind DN that performed the original delete */
-	    ptoken = ldap_utf8strtok_r (NULL, delimiter, &iter);
-	    if (!strcasecmp(ptoken, "NULL")) {
-	        binddn = NULL;
-	    } else {
-	    	slapi_pblock_set(pb, SLAPI_REQUESTOR_DN, ptoken);
-	    }
       
-	    update_integrity(pb, plugin_argv, sdn, tmprdn,
+	    update_integrity(plugin_argv, sdn, tmprdn,
 	                     tmpsuperior, logChanges, NULL);
       
 	    slapi_sdn_free(&sdn);
@@ -1037,7 +1025,7 @@ referint_thread_func(void *arg)
 		PR_DestroyCondVar(keeprunning_cv);
 	}
 
-	slapi_pblock_destroy(pb);
+
 }
 
 int my_fgetc(PRFileDesc *stream)
@@ -1117,14 +1105,15 @@ GetNextLine(char *dest, int size_dest, PRFileDesc *stream) {
 }
 
 void
-writeintegritylog(Slapi_PBlock *pb, char *logfilename, Slapi_DN *sdn,
-                  char *newrdn, Slapi_DN *newsuperior)
+writeintegritylog(char *logfilename, Slapi_DN *sdn, 
+                  char *newrdn, Slapi_DN *newsuperior, Slapi_DN *requestorsdn)
 {
     PRFileDesc *prfd;
     char buffer[MAX_LINE];
-    char *dn = NULL;
     int len_to_write = 0;
     int rc;
+    const char *requestordn = NULL;
+    size_t reqdn_len = 0;
     /* write this record to the file */
 
     /* use this lock to protect file data when update integrity is occuring */
@@ -1147,8 +1136,8 @@ writeintegritylog(Slapi_PBlock *pb, char *logfilename, Slapi_DN *sdn,
        before trying to write it 
      */
 
-	/* add length of dn +  4(two tabs, a newline, and terminating \0) */
-    len_to_write = slapi_sdn_get_ndn_len(sdn) + 4;
+	/* add length of dn +  5(three tabs, a newline, and terminating \0) */
+    len_to_write = slapi_sdn_get_ndn_len(sdn) + 5;
 
     if(newrdn == NULL)
     {
@@ -1166,6 +1155,12 @@ writeintegritylog(Slapi_PBlock *pb, char *logfilename, Slapi_DN *sdn,
         /* add the length of the newsuperior */
         len_to_write += slapi_sdn_get_ndn_len(newsuperior);
     }
+    if (requestorsdn && (requestordn = slapi_sdn_get_udn(requestorsdn)) &&
+        (reqdn_len = strlen(requestordn))) {
+        len_to_write += reqdn_len;
+    } else {
+        len_to_write += 4; /* "NULL" */
+    }
 
     if(len_to_write > MAX_LINE )
     {
@@ -1174,12 +1169,12 @@ writeintegritylog(Slapi_PBlock *pb, char *logfilename, Slapi_DN *sdn,
                          " line length exceeded. It will not be able"
                          " to update references to this entry.\n");
     }else{
-       slapi_pblock_get(pb, SLAPI_REQUESTOR_DN, &dn);
-       PR_snprintf(buffer, MAX_LINE, "%s\t%s\t%s\t%s\t\n",
+       PR_snprintf(buffer, MAX_LINE, "%s\t%s\t%s\t%s\t\n", 
 				   slapi_sdn_get_dn(sdn),
 				   (newrdn != NULL) ? newrdn : "NULL",
-				   (newsuperior != NULL) ? slapi_sdn_get_dn(newsuperior) : "NULL",
-				   dn );
+				   (newsuperior != NULL) ? slapi_sdn_get_dn(newsuperior) :
+				                           "NULL",
+                   requestordn ? requestordn : "NULL");
         if (PR_Write(prfd,buffer,strlen(buffer)) < 0){
            slapi_log_error(SLAPI_LOG_FATAL,REFERINT_PLUGIN_SUBSYSTEM,
 	       " writeintegritylog: PR_Write failed : The disk"

+ 8 - 30
ldap/servers/slapd/add.c

@@ -73,7 +73,7 @@
 /* Forward declarations */
 static int add_internal_pb (Slapi_PBlock *pb);
 static void op_shared_add (Slapi_PBlock *pb);
-static int add_created_attrs(Slapi_PBlock *pb, Slapi_Entry *e);
+static int add_created_attrs(Operation *op, Slapi_Entry *e);
 static int check_rdn_for_created_attrs(Slapi_Entry *e);
 static void handle_fast_add(Slapi_PBlock *pb, Slapi_Entry *entry);
 static int add_uniqueid (Slapi_Entry *e);
@@ -390,15 +390,8 @@ void slapi_add_entry_internal_set_pb (Slapi_PBlock *pb, Slapi_Entry *e, LDAPCont
 		return;
 	}
 
-	/* if the operation is not NULL, then it was already set */
-	if(pb->pb_op == NULL){
-		op = internal_operation_new(SLAPI_OPERATION_ADD,operation_flags);
-		slapi_pblock_set(pb, SLAPI_OPERATION, op);
-	} else {
-		/* we still want to set the flags & type though */
-		operation_set_flag(pb->pb_op, operation_flags);
-		operation_set_type(pb->pb_op, SLAPI_OPERATION_ADD);
-	}
+	op = internal_operation_new(SLAPI_OPERATION_ADD,operation_flags);
+	slapi_pblock_set(pb, SLAPI_OPERATION, op);
 	slapi_pblock_set(pb, SLAPI_ADD_ENTRY, e);
 	slapi_pblock_set(pb, SLAPI_CONTROLS_ARG, controls);
 	slapi_pblock_set(pb, SLAPI_PLUGIN_IDENTITY, plugin_identity);
@@ -639,7 +632,7 @@ static void op_shared_add (Slapi_PBlock *pb)
 		/* can get lastmod only after backend is selected */
 		slapi_pblock_get(pb, SLAPI_BE_LASTMOD, &lastmod);
 
-		if (lastmod && add_created_attrs(pb, e) != 0)
+		if (lastmod && add_created_attrs(operation, e) != 0)
 		{
 			send_ldap_result(pb, LDAP_UNWILLING_TO_PERFORM, NULL,
 				"cannot insert computed attributes", 0, NULL);
@@ -745,39 +738,24 @@ done:
 }
 
 static int 
-add_created_attrs(Slapi_PBlock *pb, Slapi_Entry *e)
+add_created_attrs(Operation *op, Slapi_Entry *e)
 {
 	char   buf[20];
 	struct berval	bv;
 	struct berval	*bvals[2];
 	time_t		curtime;
 	struct tm	ltm;
-	Operation    *op;
-	char *plugin_dn = NULL;
-	struct slapdplugin *plugin = NULL;
-	struct slapi_componentid *cid = NULL;
 	slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
 
 	LDAPDebug(LDAP_DEBUG_TRACE, "add_created_attrs\n", 0, 0, 0);
 
-	slapi_pblock_get(pb, SLAPI_OPERATION, &op);
 	bvals[0] = &bv;
 	bvals[1] = NULL;
 	
 	if(slapdFrontendConfig->plugin_track && !slapi_sdn_isempty(&op->o_sdn)){
-		/* write the bind dn and plugin name to the new attributes  */
-		slapi_pblock_get (pb, SLAPI_PLUGIN_IDENTITY, &cid);
-		if (cid)
-			plugin=(struct slapdplugin *) cid->sci_plugin;
-		if(plugin)
-			plugin_dn = plugin_get_dn(plugin);
-		if(plugin_dn){
-			bv.bv_val = plugin_dn;
-			bv.bv_len = strlen(bv.bv_val);
-		} else {
-			bv.bv_val = (char*)slapi_sdn_get_dn(&op->o_sdn);
-			bv.bv_len = strlen(bv.bv_val);
-		}
+        /* assume op->o_sdn holds the plugin DN */
+        bv.bv_val = (char*)slapi_sdn_get_dn(&op->o_sdn);
+        bv.bv_len = strlen(bv.bv_val);
 		slapi_entry_attr_replace(e, "internalCreatorsName", bvals);
 		slapi_entry_attr_replace(e, "internalModifiersName", bvals);
 	}

+ 4 - 16
ldap/servers/slapd/modify.c

@@ -489,14 +489,8 @@ slapi_modify_internal_set_pb (Slapi_PBlock *pb, const char *dn,
 		return;
 	}
 
-	/* if we're tracking the plugin bind dn, then just set the type/flags */
-	if(pb->plugin_tracking){
-		operation_set_flag(pb->pb_op, operation_flags);
-		operation_set_type(pb->pb_op, SLAPI_OPERATION_MODIFY);
-	} else {
-		op = internal_operation_new(SLAPI_OPERATION_MODIFY,operation_flags);
-		slapi_pblock_set(pb, SLAPI_OPERATION, op);
-	}
+	op= internal_operation_new(SLAPI_OPERATION_MODIFY,operation_flags);
+	slapi_pblock_set(pb, SLAPI_OPERATION, op);       
 	slapi_pblock_set(pb, SLAPI_ORIGINAL_TARGET, (void*)dn);
 	slapi_pblock_set(pb, SLAPI_MODIFY_MODS, mods);
 	slapi_pblock_set(pb, SLAPI_CONTROLS_ARG, controls);
@@ -524,14 +518,8 @@ slapi_modify_internal_set_pb_ext(Slapi_PBlock *pb, const Slapi_DN *sdn,
 		return;
 	}
 
-	/* if we're tracking the plugin bind dn, then just set the type/flags */
-	if(pb->plugin_tracking){
-		operation_set_flag(pb->pb_op, operation_flags);
-		operation_set_type(pb->pb_op, SLAPI_OPERATION_MODIFY);
-	} else {
-		op = internal_operation_new(SLAPI_OPERATION_MODIFY,operation_flags);
-		slapi_pblock_set(pb, SLAPI_OPERATION, op);
-	}
+	op= internal_operation_new(SLAPI_OPERATION_MODIFY,operation_flags);
+	slapi_pblock_set(pb, SLAPI_OPERATION, op);       
 	slapi_pblock_set(pb, SLAPI_ORIGINAL_TARGET, (void *)slapi_sdn_get_dn(sdn));
 	slapi_pblock_set(pb, SLAPI_TARGET_SDN, (void *)sdn);
 	slapi_pblock_set(pb, SLAPI_MODIFY_MODS, mods);

+ 2 - 8
ldap/servers/slapd/modrdn.c

@@ -359,14 +359,8 @@ slapi_rename_internal_set_pb_ext(Slapi_PBlock *pb,
         return;
     }
 
-    /* if we're tracking the plugin bind dn, then just set the type/flags */
-    if(pb->plugin_tracking){
-    	operation_set_flag(pb->pb_op, operation_flags);
-    	operation_set_type(pb->pb_op, SLAPI_OPERATION_MODRDN);
-    } else {
-        op = internal_operation_new(SLAPI_OPERATION_MODRDN,operation_flags);
-    	slapi_pblock_set(pb, SLAPI_OPERATION, op);
-    }
+    op = internal_operation_new(SLAPI_OPERATION_MODRDN,operation_flags); 
+    slapi_pblock_set(pb, SLAPI_OPERATION, op); 
     slapi_pblock_set(pb, SLAPI_ORIGINAL_TARGET, 
                      (void*)slapi_sdn_get_dn(olddn));
     slapi_pblock_set(pb, SLAPI_MODRDN_TARGET_SDN, (void*)olddn);

+ 2 - 47
ldap/servers/slapd/pblock.c

@@ -96,50 +96,13 @@ slapi_pblock_new()
 	return pb;
 }
 
-/* Use for internal operations by plugins, where we need to track the bind dn */
-Slapi_PBlock *
-slapi_pblock_new_by_pb(Slapi_PBlock *origpb)
-{
-	Slapi_PBlock	*pb;
-
-	pb = (Slapi_PBlock *) slapi_ch_calloc( 1, sizeof(Slapi_PBlock) );
-	pb->pb_op = operation_new(OP_FLAG_INTERNAL);
-	pb->plugin_tracking = 1;
-
-	if(origpb == NULL){
-		return pb;
-	}
-
-	if(origpb->pb_op != NULL){
-		slapi_sdn_set_normdn_byval((&pb->pb_op->o_sdn), slapi_sdn_get_dn(&origpb->pb_op->o_sdn));
-	} else {
-		/* No operation?  Have to use the plugin name */
-		if(origpb->pb_plugin->plg_name){
-			slapi_sdn_set_normdn_byval((&pb->pb_op->o_sdn), origpb->pb_plugin->plg_name);
-		}
-	}
-
-	return pb;
-}
-
 void
 slapi_pblock_init( Slapi_PBlock *pb )
 {
-	Slapi_Operation *op;
-
 	if(pb!=NULL)
 	{
-		if(pb->plugin_tracking){
-			/* preserve the op, and then reset everything */
-			op = pb->pb_op;
-			pblock_done_by_pb(pb);
-			pblock_init(pb);
-			pb->pb_op = op;
-			pb->plugin_tracking = 1;
-		} else {
-			pblock_done(pb);
-			pblock_init(pb);
-		}
+		pblock_done(pb);
+		pblock_init(pb);
 	}
 }
 
@@ -154,14 +117,6 @@ pblock_done( Slapi_PBlock *pb )
 	slapi_ch_free((void**)&(pb->pb_result_text));
 }
 
-void
-pblock_done_by_pb( Slapi_PBlock *pb )
-{
-	/* don't free the operation because we still want to use it */
-	slapi_ch_free((void**)&(pb->pb_vattr_context));
-	slapi_ch_free((void**)&(pb->pb_result_text));
-}
-
 void
 slapi_pblock_destroy( Slapi_PBlock* pb )
 {

+ 0 - 1
ldap/servers/slapd/proto-slap.h

@@ -1083,7 +1083,6 @@ void do_unbind( Slapi_PBlock *pb );
 void pblock_init( Slapi_PBlock *pb );
 void pblock_init_common( Slapi_PBlock *pb, Slapi_Backend *be, Connection *conn, Operation *op );
 void pblock_done( Slapi_PBlock *pb );
-void pblock_done_by_pb( Slapi_PBlock *pb );
 void bind_credentials_set( Connection *conn,
                 char *authtype, char *normdn,
                 char *extauthtype, char *externaldn, CERTCertificate *clientcert , Slapi_Entry * binded);

+ 0 - 13
ldap/servers/slapd/slapi-plugin.h

@@ -606,19 +606,6 @@ typedef void (*TaskCallbackFn)(Slapi_Task *task);
  */
 Slapi_PBlock *slapi_pblock_new( void ); /* allocate and initialize */
 
-/**
- * Creates a new parameter block.
- *
- * \return This function returns a pointer to the new parameter block.
- * \warning This function takes the original operation struct, and adds it the
- *          the new pb.  This is so we can track the original bind dn
- * \warning The pblock pointer allocated with this function must always be freed by
- *          slapi_pblock_destroy(). The use of other memory deallocators (for example,
- *          <tt>free()</tt>) is not supported and may lead to crashes or memory leaks.
- * \see slapi_pblock_destroy()
- */
-Slapi_PBlock *slapi_pblock_new_by_pb( Slapi_PBlock *pb ); /* allocate and initialize */
-
 /**
  * Initializes an existing parameter block for re-use.
  *