diff options
Diffstat (limited to 'src/back-shr.c')
-rw-r--r-- | src/back-shr.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/back-shr.c b/src/back-shr.c index 3ab417d..003a728 100644 --- a/src/back-shr.c +++ b/src/back-shr.c @@ -381,7 +381,6 @@ backend_shr_set_config_entry_add(struct plugin_state *state, Slapi_Entry *e, char **set_bases; char *set_entry_filter; - pb = slapi_pblock_new(); flag = FALSE; backend_set_config_read_config(state, e, group, set, &flag, &set_data); if (set_data == NULL) { @@ -389,7 +388,6 @@ backend_shr_set_config_entry_add(struct plugin_state *state, Slapi_Entry *e, state->plugin_desc->spd_id, "incomplete definition for %s in %s (2)\n", set, group); - slapi_pblock_destroy(pb); return 0; } slapi_log_error(SLAPI_LOG_PLUGIN, @@ -408,6 +406,7 @@ backend_shr_set_config_entry_add(struct plugin_state *state, Slapi_Entry *e, state->plugin_desc->spd_id, "searching '%s' for '%s'\n", set_bases[i], set_entry_filter); + pb = slapi_pblock_new(); slapi_search_internal_set_pb(pb, set_bases[i], LDAP_SCOPE_SUBTREE, @@ -421,11 +420,11 @@ backend_shr_set_config_entry_add(struct plugin_state *state, Slapi_Entry *e, NULL, backend_shr_set_entry_cb, NULL); + slapi_pblock_destroy(pb); } /* Warn if we didn't put anything into the set. */ backend_check_empty(state, set_data->group, set_data->set); /* Clean up. */ - slapi_pblock_destroy(pb); return 0; } @@ -559,11 +558,11 @@ backend_shr_startup(struct plugin_state *state, const char *filter) backend_update_params(state); - pb = slapi_pblock_new(); slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id, "searching under \"%s\" for configuration\n", state->plugin_base); + pb = slapi_pblock_new(); slapi_search_internal_set_pb(pb, state->plugin_base, LDAP_SCOPE_ONELEVEL, @@ -834,7 +833,6 @@ backend_shr_mods_as_string(LDAPMod **mods) /* Update any entries in the map for which the passed-in entry will affect the * values which are derived. */ struct backend_shr_update_references_cbdata { - Slapi_PBlock *pb; Slapi_Entry *e; LDAPMod **mods; }; @@ -855,6 +853,7 @@ backend_shr_update_references_cb(const char *group, const char *set, Slapi_ValueSet *values; Slapi_Value *value; Slapi_Filter *next_filter; + Slapi_PBlock *pb; char **ref_attrs, *actual_attr, *filter, **set_bases; char *these_attrs[2], *prev_attrs[2], *next_attrs[2]; const char *these_filter, *prev_filter, *next_filter_str; @@ -924,7 +923,8 @@ backend_shr_update_references_cb(const char *group, const char *set, for (i = 0; (set_bases != NULL) && (set_bases[i] != NULL); i++) { - slapi_search_internal_set_pb(cbdata->pb, + pb = slapi_pblock_new(); + slapi_search_internal_set_pb(pb, set_bases[i], LDAP_SCOPE_SUBTREE, filter, @@ -933,10 +933,11 @@ backend_shr_update_references_cb(const char *group, const char *set, NULL, state->plugin_identity, 0); - slapi_search_internal_callback_pb(cbdata->pb, set_data, + slapi_search_internal_callback_pb(pb, set_data, NULL, backend_shr_set_entry_cb, NULL); + slapi_pblock_destroy(pb); } free(filter); } @@ -1082,7 +1083,8 @@ backend_shr_update_references_cb(const char *group, const char *set, "with scope %d\n", slapi_sdn_get_ndn(these_bases[l]), filter, scope); - slapi_search_internal_set_pb(cbdata->pb, + pb = slapi_pblock_new(); + slapi_search_internal_set_pb(pb, slapi_sdn_get_ndn(these_bases[l]), scope, filter, @@ -1095,11 +1097,12 @@ backend_shr_update_references_cb(const char *group, const char *set, note_cbdata.state = state; note_cbdata.sdn_list = &these_entries; note_cbdata.sdn_list2 = &these_entries2; - slapi_search_internal_callback_pb(cbdata->pb, + slapi_search_internal_callback_pb(pb, ¬e_cbdata, NULL, backend_shr_note_entry_sdn_cb, NULL); + slapi_pblock_destroy(pb); } free(filter); /* Search for entries in the previous link in @@ -1121,7 +1124,8 @@ backend_shr_update_references_cb(const char *group, const char *set, "scope %d\n", slapi_sdn_get_ndn(prev_bases[l]), filter, scope); - slapi_search_internal_set_pb(cbdata->pb, + pb = slapi_pblock_new(); + slapi_search_internal_set_pb(pb, slapi_sdn_get_ndn(prev_bases[l]), scope, filter, @@ -1134,11 +1138,12 @@ backend_shr_update_references_cb(const char *group, const char *set, note_cbdata.state = state; note_cbdata.sdn_list = &prev_entries; note_cbdata.sdn_list2 = &prev_entries2; - slapi_search_internal_callback_pb(cbdata->pb, + slapi_search_internal_callback_pb(pb, ¬e_cbdata, NULL, backend_shr_note_entry_sdn_cb, NULL); + slapi_pblock_destroy(pb); } free(filter); } @@ -1257,8 +1262,9 @@ backend_shr_update_references_cb(const char *group, const char *set, slapi_sdn_get_ndn(these_entries[k])); continue; } + pb = slapi_pblock_new(); if ((next_filter != NULL) && - (slapi_filter_test(cbdata->pb, this_entry, + (slapi_filter_test(pb, this_entry, next_filter, 0) != 0)) { slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id, @@ -1267,8 +1273,10 @@ backend_shr_update_references_cb(const char *group, const char *set, slapi_sdn_get_ndn(these_entries[k]), next_filter_str); slapi_entry_free(this_entry); + slapi_pblock_destroy(pb); continue; } + slapi_pblock_destroy(pb); if (slapi_vattr_values_get(this_entry, these_attrs[0], &values, @@ -1406,7 +1414,6 @@ backend_shr_update_references(struct plugin_state *state, Slapi_Entry *e, { struct backend_shr_update_references_cbdata cbdata; cbdata.e = e; - cbdata.pb = slapi_pblock_new(); cbdata.mods = mods; if (!map_data_foreach_map(state, NULL, backend_shr_update_references_cb, &cbdata)) { @@ -1415,7 +1422,6 @@ backend_shr_update_references(struct plugin_state *state, Slapi_Entry *e, "error updating references for \"%s\"\n", slapi_entry_get_ndn(cbdata.e)); } - slapi_pblock_destroy(cbdata.pb); } /* Add any map entries which correspond to a directory server entry in this |