ldap/servers/plugins/acctpolicy/acct_plugin.c | 19 - ldap/servers/plugins/acctpolicy/acct_util.c | 6 ldap/servers/plugins/acctpolicy/acctpolicy.h | 2 ldap/servers/plugins/automember/automember.c | 59 ++--- ldap/servers/plugins/deref/deref.c | 4 ldap/servers/plugins/dna/dna.c | 147 ++++++------- ldap/servers/plugins/linkedattrs/fixup_task.c | 56 +---- ldap/servers/plugins/linkedattrs/linked_attrs.c | 81 +++---- ldap/servers/plugins/linkedattrs/linked_attrs.h | 1 ldap/servers/plugins/memberof/memberof.c | 251 +++++++++-------------- ldap/servers/plugins/mep/mep.c | 99 +++------ ldap/servers/plugins/referint/referint.c | 99 +++------ ldap/servers/plugins/replication/urp.c | 60 ++--- ldap/servers/plugins/replication/urp.h | 10 ldap/servers/plugins/replication/urp_glue.c | 12 - ldap/servers/plugins/replication/urp_tombstone.c | 14 - ldap/servers/plugins/retrocl/retrocl_po.c | 4 ldap/servers/plugins/uiduniq/plugin-utils.h | 6 ldap/servers/plugins/uiduniq/uid.c | 43 +-- ldap/servers/plugins/uiduniq/utils.c | 29 +- ldap/servers/slapd/add.c | 38 --- ldap/servers/slapd/modify.c | 24 -- ldap/servers/slapd/modrdn.c | 10 ldap/servers/slapd/passwd_extop.c | 4 ldap/servers/slapd/pblock.c | 49 ---- ldap/servers/slapd/plugin_internal_op.c | 14 - ldap/servers/slapd/proto-slap.h | 2 ldap/servers/slapd/pw.c | 11 - ldap/servers/slapd/pw_mgmt.c | 16 - ldap/servers/slapd/pw_retry.c | 26 -- ldap/servers/slapd/slapi-plugin.h | 16 - 31 files changed, 436 insertions(+), 776 deletions(-)
New commits: commit 85d44fc98a0b24b59d7e9524aef3c536f9a78879 Author: Rich Megginson rmeggins@redhat.com Date: Thu Feb 16 17:22:56 2012 -0700
Revert "pass the plugin config entry to the plugin init function"
This reverts commit b6d3ba77683722ed8b88994a637ba64fa18e57a1. Reverts only the txn code
diff --git a/ldap/servers/slapd/plugin_internal_op.c b/ldap/servers/slapd/plugin_internal_op.c index 1ac2447..cf65c2c 100644 --- a/ldap/servers/slapd/plugin_internal_op.c +++ b/ldap/servers/slapd/plugin_internal_op.c @@ -912,7 +912,7 @@ void set_common_params (Slapi_PBlock *pb) * copy of the entry, NULL can be passed for ret_entry. */ int -slapi_search_internal_get_entry_ext( Slapi_DN *dn, char ** attrs, Slapi_Entry **ret_entry , void * component_identity, void *txn ) +slapi_search_internal_get_entry( Slapi_DN *dn, char ** attrs, Slapi_Entry **ret_entry , void * component_identity) { Slapi_Entry **entries = NULL; Slapi_PBlock *int_search_pb = NULL; @@ -928,7 +928,6 @@ slapi_search_internal_get_entry_ext( Slapi_DN *dn, char ** attrs, Slapi_Entry ** 0 /* attrsonly */, NULL /* controls */, NULL /* uniqueid */, component_identity, 0 /* actions */ ); - slapi_pblock_set( int_search_pb, SLAPI_TXN, txn ); slapi_search_internal_pb ( int_search_pb ); slapi_pblock_get( int_search_pb, SLAPI_PLUGIN_INTOP_RESULT, &rc ); if ( LDAP_SUCCESS == rc ) { @@ -950,14 +949,3 @@ slapi_search_internal_get_entry_ext( Slapi_DN *dn, char ** attrs, Slapi_Entry ** int_search_pb = NULL; return rc; } - -/* - * Given a DN, find an entry by doing an internal search. An LDAP error - * code is returned. To check if an entry exists without returning a - * copy of the entry, NULL can be passed for ret_entry. - */ -int -slapi_search_internal_get_entry( Slapi_DN *dn, char ** attrs, Slapi_Entry **ret_entry , void * component_identity) -{ - return slapi_search_internal_get_entry_ext(dn, attrs, ret_entry, component_identity, NULL); -} diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h index 20c7a5c..3444b7e 100644 --- a/ldap/servers/slapd/slapi-plugin.h +++ b/ldap/servers/slapd/slapi-plugin.h @@ -5470,9 +5470,6 @@ void slapi_seq_internal_set_pb(Slapi_PBlock *pb, char *ibase, int type, */ int slapi_search_internal_get_entry( Slapi_DN *dn, char ** attrlist, Slapi_Entry **ret_entry , void *caller_identity); -/* same as above but can pass in the txn to use */ -int slapi_search_internal_get_entry_ext( Slapi_DN *dn, char ** attrlist, - Slapi_Entry **ret_entry , void *caller_identity, void *txn );
/* * interface for registering object extensions.
commit a1201df9ac1a5481efa4f07e55c1da2b3a650e6d Author: Rich Megginson rmeggins@redhat.com Date: Thu Feb 16 17:16:11 2012 -0700
Revert "make memberof transaction aware and able to be a betxnpostoperation plugin"
This reverts commit 1d2f5a0c138f560f192be387b37880d7675809ef. Reverts the SLAPI_TXN stuff but leaves the code that allows memberof to be either a regular or a betxn plugin.
diff --git a/ldap/servers/plugins/memberof/memberof.c b/ldap/servers/plugins/memberof/memberof.c index 5100b1a..56e34d4 100644 --- a/ldap/servers/plugins/memberof/memberof.c +++ b/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; - void *txn; } memberof_get_groups_data;
/*** function prototypes ***/ @@ -113,55 +112,55 @@ static int memberof_postop_close(Slapi_PBlock *pb); static int memberof_oktodo(Slapi_PBlock *pb); static char *memberof_getdn(Slapi_PBlock *pb); static int memberof_modop_one(Slapi_PBlock *pb, MemberOfConfig *config, int mod_op, - char *op_this, char *op_to, void *txn); + char *op_this, char *op_to); static int memberof_modop_one_r(Slapi_PBlock *pb, MemberOfConfig *config, int mod_op, - char *group_dn, char *op_this, char *op_to, memberofstringll *stack, void *txn); + char *group_dn, char *op_this, char *op_to, memberofstringll *stack); static int memberof_add_one(Slapi_PBlock *pb, MemberOfConfig *config, char *addthis, - char *addto, void *txn); + char *addto); static int memberof_del_one(Slapi_PBlock *pb, MemberOfConfig *config, char *delthis, - char *delfrom, void *txn); + char *delfrom); static int memberof_mod_smod_list(Slapi_PBlock *pb, MemberOfConfig *config, int mod, - char *groupdn, Slapi_Mod *smod, void *txn); + char *groupdn, Slapi_Mod *smod); static int memberof_add_smod_list(Slapi_PBlock *pb, MemberOfConfig *config, - char *groupdn, Slapi_Mod *smod, void *txn); + char *groupdn, Slapi_Mod *smod); static int memberof_del_smod_list(Slapi_PBlock *pb, MemberOfConfig *config, - char *groupdn, Slapi_Mod *smod, void *txn); + char *groupdn, Slapi_Mod *smod); static int memberof_mod_attr_list(Slapi_PBlock *pb, MemberOfConfig *config, int mod, - char *groupdn, Slapi_Attr *attr, void *txn); + char *groupdn, Slapi_Attr *attr); static int memberof_mod_attr_list_r(Slapi_PBlock *pb, MemberOfConfig *config, - int mod, char *group_dn, char *op_this, Slapi_Attr *attr, memberofstringll *stack, void *txn); + int mod, char *group_dn, char *op_this, Slapi_Attr *attr, memberofstringll *stack); static int memberof_add_attr_list(Slapi_PBlock *pb, MemberOfConfig *config, - char *groupdn, Slapi_Attr *attr, void *txn); + char *groupdn, Slapi_Attr *attr); static int memberof_del_attr_list(Slapi_PBlock *pb, MemberOfConfig *config, - char *groupdn, Slapi_Attr *attr, void *txn); + char *groupdn, Slapi_Attr *attr); static int memberof_moddn_attr_list(Slapi_PBlock *pb, MemberOfConfig *config, - char *pre_dn, char *post_dn, Slapi_Attr *attr, void *txn); -static int memberof_replace_list(Slapi_PBlock *pb, MemberOfConfig *config, char *group_dn, void *txn); + char *pre_dn, char *post_dn, Slapi_Attr *attr); +static int memberof_replace_list(Slapi_PBlock *pb, MemberOfConfig *config, char *group_dn); static void memberof_set_plugin_id(void * plugin_id); static void *memberof_get_plugin_id(); static int memberof_compare(MemberOfConfig *config, const void *a, const void *b); static int memberof_qsort_compare(const void *a, const void *b); static void memberof_load_array(Slapi_Value **array, Slapi_Attr *attr); -static void memberof_del_dn_from_groups(Slapi_PBlock *pb, MemberOfConfig *config, char *dn, void *txn); +static void memberof_del_dn_from_groups(Slapi_PBlock *pb, MemberOfConfig *config, char *dn); static int memberof_call_foreach_dn(Slapi_PBlock *pb, char *dn, - char **types, plugin_search_entry_callback callback, void *callback_data, void *txn); + char **types, plugin_search_entry_callback callback, void *callback_data); static int memberof_is_direct_member(MemberOfConfig *config, Slapi_Value *groupdn, - Slapi_Value *memberdn, void *txn); + Slapi_Value *memberdn); static int memberof_is_grouping_attr(char *type, MemberOfConfig *config); -static Slapi_ValueSet *memberof_get_groups(MemberOfConfig *config, char *memberdn, void *txn); +static Slapi_ValueSet *memberof_get_groups(MemberOfConfig *config, char *memberdn); static int memberof_get_groups_r(MemberOfConfig *config, char *memberdn, - memberof_get_groups_data *data, void *txn); + memberof_get_groups_data *data); static int memberof_get_groups_callback(Slapi_Entry *e, void *callback_data); static int memberof_test_membership(Slapi_PBlock *pb, MemberOfConfig *config, - char *group_dn, void *txn); + char *group_dn); static int memberof_test_membership_callback(Slapi_Entry *e, void *callback_data); static int memberof_del_dn_type_callback(Slapi_Entry *e, void *callback_data); static int memberof_replace_dn_type_callback(Slapi_Entry *e, void *callback_data); static void memberof_replace_dn_from_groups(Slapi_PBlock *pb, MemberOfConfig *config, - char *pre_dn, char *post_dn, void *txn); + char *pre_dn, char *post_dn); static int memberof_modop_one_replace_r(Slapi_PBlock *pb, MemberOfConfig *config, int mod_op, char *group_dn, char *op_this, char *replace_with, char *op_to, - memberofstringll *stack, void *txn); + memberofstringll *stack); static int memberof_task_add(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter, int *returncode, char *returntext, void *arg); @@ -169,7 +168,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(MemberOfConfig *config, char *dn, char *filter_str, void *txn); +static int memberof_fix_memberof(MemberOfConfig *config, char *dn, char *filter_str); static int memberof_fix_memberof_callback(Slapi_Entry *e, void *callback_data);
@@ -399,10 +398,8 @@ int memberof_postop_del(Slapi_PBlock *pb) if(memberof_oktodo(pb) && (normdn = memberof_getdn(pb))) { struct slapi_entry *e = NULL; - void *txn = NULL;
slapi_pblock_get( pb, SLAPI_ENTRY_PRE_OP, &e ); - slapi_pblock_get( pb, SLAPI_TXN, &txn );
/* We need to get the config lock first. Trying to get the * config lock after we already hold the op lock can cause @@ -418,7 +415,7 @@ int memberof_postop_del(Slapi_PBlock *pb) /* remove this DN from the * membership lists of groups */ - memberof_del_dn_from_groups(pb, &configCopy, normdn, txn); + memberof_del_dn_from_groups(pb, &configCopy, normdn);
/* is the entry of interest as a group? */ if(e && configCopy.group_filter && !slapi_filter_test_simple(e, configCopy.group_filter)) @@ -431,7 +428,7 @@ int memberof_postop_del(Slapi_PBlock *pb) { if (0 == slapi_entry_attr_find(e, configCopy.groupattrs[i], &attr)) { - memberof_del_attr_list(pb, &configCopy, normdn, attr, txn); + memberof_del_attr_list(pb, &configCopy, normdn, attr); } } } @@ -450,12 +447,11 @@ typedef struct _memberof_del_dn_data { char *dn; char *type; - void *txn; } memberof_del_dn_data;
/* Deletes a member dn from all groups that refer to it. */ static void -memberof_del_dn_from_groups(Slapi_PBlock *pb, MemberOfConfig *config, char *dn, void *txn) +memberof_del_dn_from_groups(Slapi_PBlock *pb, MemberOfConfig *config, char *dn) { int i = 0; char *groupattrs[2] = {0, 0}; @@ -465,12 +461,12 @@ 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 = {dn, config->groupattrs[i], txn}; + memberof_del_dn_data data = {dn, config->groupattrs[i]};
groupattrs[0] = config->groupattrs[i];
memberof_call_foreach_dn(pb, dn, groupattrs, - memberof_del_dn_type_callback, &data, txn); + memberof_del_dn_type_callback, &data); } }
@@ -499,7 +495,6 @@ int memberof_del_dn_type_callback(Slapi_Entry *e, void *callback_data) mods, 0, 0, memberof_get_plugin_id(), 0);
- slapi_pblock_set(mod_pb, SLAPI_TXN, ((memberof_del_dn_data *)callback_data)->txn); slapi_modify_internal_pb(mod_pb);
slapi_pblock_get(mod_pb, @@ -518,7 +513,7 @@ int memberof_del_dn_type_callback(Slapi_Entry *e, void *callback_data) * case. */ int memberof_call_foreach_dn(Slapi_PBlock *pb, char *dn, - char **types, plugin_search_entry_callback callback, void *callback_data, void *txn) + char **types, plugin_search_entry_callback callback, void *callback_data) { int rc = 0; Slapi_PBlock *search_pb = slapi_pblock_new(); @@ -531,7 +526,6 @@ int memberof_call_foreach_dn(Slapi_PBlock *pb, char *dn, int dn_len = 0; int i = 0;
- slapi_pblock_set(search_pb, SLAPI_TXN, txn); /* get the base dn for the backend we are in (we don't support having members and groups in different backends - issues with offline / read only backends) @@ -634,11 +628,9 @@ int memberof_postop_modrdn(Slapi_PBlock *pb) struct slapi_entry *post_e = NULL; char *pre_dn = 0; char *post_dn = 0; - void *txn = NULL;
slapi_pblock_get( pb, SLAPI_ENTRY_PRE_OP, &pre_e ); slapi_pblock_get( pb, SLAPI_ENTRY_POST_OP, &post_e ); - slapi_pblock_get( pb, SLAPI_TXN, &txn ); if(pre_e && post_e) { @@ -667,7 +659,7 @@ int memberof_postop_modrdn(Slapi_PBlock *pb) { if(0 == slapi_entry_attr_find(post_e, configCopy.groupattrs[i], &attr)) { - if(memberof_moddn_attr_list(pb, &configCopy, pre_dn, post_dn, attr, txn) != 0){ + if(memberof_moddn_attr_list(pb, &configCopy, pre_dn, post_dn, attr) != 0){ break; } } @@ -678,7 +670,7 @@ int memberof_postop_modrdn(Slapi_PBlock *pb) * of other group entries. We need to update any member * attributes to refer to the new name. */ if (pre_dn && post_dn) { - memberof_replace_dn_from_groups(pb, &configCopy, pre_dn, post_dn, txn); + memberof_replace_dn_from_groups(pb, &configCopy, pre_dn, post_dn); }
memberof_unlock(); @@ -696,7 +688,6 @@ typedef struct _replace_dn_data char *pre_dn; char *post_dn; char *type; - void *txn; } replace_dn_data;
@@ -704,7 +695,7 @@ typedef struct _replace_dn_data * to use post_dn instead. */ static void memberof_replace_dn_from_groups(Slapi_PBlock *pb, MemberOfConfig *config, - char *pre_dn, char *post_dn, void *txn) + char *pre_dn, char *post_dn) { int i = 0; char *groupattrs[2] = {0, 0}; @@ -714,12 +705,12 @@ 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 = {pre_dn, post_dn, config->groupattrs[i], txn}; + replace_dn_data data = {pre_dn, post_dn, config->groupattrs[i]};
groupattrs[0] = config->groupattrs[i];
memberof_call_foreach_dn(pb, pre_dn, groupattrs, - memberof_replace_dn_type_callback, &data, txn); + memberof_replace_dn_type_callback, &data); } }
@@ -759,7 +750,6 @@ int memberof_replace_dn_type_callback(Slapi_Entry *e, void *callback_data) mods, 0, 0, memberof_get_plugin_id(), 0);
- slapi_pblock_set(mod_pb, SLAPI_TXN, ((replace_dn_data *)callback_data)->txn); slapi_modify_internal_pb(mod_pb);
slapi_pblock_get(mod_pb, @@ -812,9 +802,7 @@ int memberof_postop_modify(Slapi_PBlock *pb) int config_copied = 0; MemberOfConfig *mainConfig = 0; MemberOfConfig configCopy = {0, 0, 0, 0}; - void *txn = NULL;
- slapi_pblock_get(pb, SLAPI_TXN, &txn); /* get the mod set */ slapi_pblock_get(pb, SLAPI_MODIFY_MODS, &mods); smods = slapi_mods_new(); @@ -865,7 +853,7 @@ int memberof_postop_modify(Slapi_PBlock *pb) case LDAP_MOD_ADD: { /* add group DN to targets */ - memberof_add_smod_list(pb, &configCopy, normdn, smod, txn); + memberof_add_smod_list(pb, &configCopy, normdn, smod); break; } @@ -877,12 +865,12 @@ int memberof_postop_modify(Slapi_PBlock *pb) * entry, which the replace code deals with. */ if (slapi_mod_get_num_values(smod) == 0) { - memberof_replace_list(pb, &configCopy, normdn, txn); + memberof_replace_list(pb, &configCopy, normdn); } else { /* remove group DN from target values in smod*/ - memberof_del_smod_list(pb, &configCopy, normdn, smod, txn); + memberof_del_smod_list(pb, &configCopy, normdn, smod); } break; } @@ -890,7 +878,7 @@ int memberof_postop_modify(Slapi_PBlock *pb) case LDAP_MOD_REPLACE: { /* replace current values */ - memberof_replace_list(pb, &configCopy, normdn, txn); + memberof_replace_list(pb, &configCopy, normdn); break; }
@@ -955,10 +943,9 @@ int memberof_postop_add(Slapi_PBlock *pb) MemberOfConfig *mainConfig = 0; MemberOfConfig configCopy = {0, 0, 0, 0}; struct slapi_entry *e = NULL; - void *txn = NULL;
slapi_pblock_get( pb, SLAPI_ENTRY_POST_OP, &e ); - slapi_pblock_get( pb, SLAPI_TXN, &txn ); +
/* is the entry of interest? */ memberof_rlock_config(); @@ -983,7 +970,7 @@ int memberof_postop_add(Slapi_PBlock *pb) { if(0 == slapi_entry_attr_find(e, configCopy.groupattrs[i], &attr)) { - memberof_add_attr_list(pb, &configCopy, normdn, attr, txn); + memberof_add_attr_list(pb, &configCopy, normdn, attr); } }
@@ -1073,9 +1060,9 @@ char *memberof_getdn(Slapi_PBlock *pb) * Also, we must not delete entries that are a member of the group */ int memberof_modop_one(Slapi_PBlock *pb, MemberOfConfig *config, int mod_op, - char *op_this, char *op_to, void *txn) + char *op_this, char *op_to) { - return memberof_modop_one_r(pb, config, mod_op, op_this, op_this, op_to, 0, txn); + return memberof_modop_one_r(pb, config, mod_op, op_this, op_this, op_to, 0); }
/* memberof_modop_one_r() @@ -1084,24 +1071,19 @@ int memberof_modop_one(Slapi_PBlock *pb, MemberOfConfig *config, int mod_op, */
int memberof_modop_one_r(Slapi_PBlock *pb, MemberOfConfig *config, int mod_op, - char *group_dn, char *op_this, char *op_to, memberofstringll *stack, void *txn) + char *group_dn, char *op_this, char *op_to, memberofstringll *stack) { return memberof_modop_one_replace_r( - pb, config, mod_op, group_dn, op_this, 0, op_to, stack, txn); + pb, config, mod_op, group_dn, op_this, 0, op_to, stack); }
-struct fix_memberof_callback_data { - MemberOfConfig *config; - void *txn; -}; - /* memberof_modop_one_replace_r() * * recursive function to perform above (with added replace arg) */ int memberof_modop_one_replace_r(Slapi_PBlock *pb, MemberOfConfig *config, int mod_op, char *group_dn, char *op_this, char *replace_with, - char *op_to, memberofstringll *stack, void *txn) + char *op_to, memberofstringll *stack) { int rc = 0; LDAPMod mod; @@ -1125,8 +1107,8 @@ int memberof_modop_one_replace_r(Slapi_PBlock *pb, MemberOfConfig *config,
/* determine if this is a group op or single entry */ op_to_sdn = slapi_sdn_new_normdn_byref(op_to); - slapi_search_internal_get_entry_ext( op_to_sdn, config->groupattrs, - &e, memberof_get_plugin_id(), txn); + slapi_search_internal_get_entry( op_to_sdn, config->groupattrs, + &e, memberof_get_plugin_id()); if(!e) { /* In the case of a delete, we need to worry about the @@ -1165,7 +1147,6 @@ int memberof_modop_one_replace_r(Slapi_PBlock *pb, MemberOfConfig *config, slapi_search_internal_set_pb(search_pb, slapi_sdn_get_dn(base_sdn), LDAP_SCOPE_SUBTREE, filter_str, 0, 0, 0, 0, memberof_get_plugin_id(), 0); - slapi_pblock_set(search_pb, SLAPI_TXN, txn);
if (slapi_search_internal_pb(search_pb)) { @@ -1185,7 +1166,7 @@ int memberof_modop_one_replace_r(Slapi_PBlock *pb, MemberOfConfig *config, * entry. This will fix the references to * the missing group as well as the group * represented by op_this. */ - memberof_test_membership(pb, config, op_to, txn); + memberof_test_membership(pb, config, op_to); } }
@@ -1268,7 +1249,7 @@ int memberof_modop_one_replace_r(Slapi_PBlock *pb, MemberOfConfig *config, slapi_entry_attr_find( e, config->groupattrs[i], &members ); if(members) { - if(memberof_mod_attr_list_r(pb, config, mod_op, group_dn, op_this, members, ll, txn) != 0){ + if(memberof_mod_attr_list_r(pb, config, mod_op, group_dn, op_this, members, ll) != 0){ rc = -1; goto bail; } @@ -1309,8 +1290,7 @@ 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 = {config, txn}; - memberof_fix_memberof_callback(e, &cb_data); + memberof_fix_memberof_callback(e, config); } else { /* single entry - do mod */ mod_pb = slapi_pblock_new(); @@ -1347,7 +1327,6 @@ int memberof_modop_one_replace_r(Slapi_PBlock *pb, MemberOfConfig *config, mods, 0, 0, memberof_get_plugin_id(), 0);
- slapi_pblock_set(mod_pb, SLAPI_TXN, txn); slapi_modify_internal_pb(mod_pb);
slapi_pblock_get(mod_pb, @@ -1373,9 +1352,9 @@ bail: * Add addthis DN to the memberof attribute of addto * */ -int memberof_add_one(Slapi_PBlock *pb, MemberOfConfig *config, char *addthis, char *addto, void *txn) +int memberof_add_one(Slapi_PBlock *pb, MemberOfConfig *config, char *addthis, char *addto) { - return memberof_modop_one(pb, config, LDAP_MOD_ADD, addthis, addto, txn); + return memberof_modop_one(pb, config, LDAP_MOD_ADD, addthis, addto); }
/* @@ -1384,9 +1363,9 @@ int memberof_add_one(Slapi_PBlock *pb, MemberOfConfig *config, char *addthis, ch * Delete delthis DN from the memberof attribute of delfrom * */ -int memberof_del_one(Slapi_PBlock *pb, MemberOfConfig *config, char *delthis, char *delfrom, void *txn) +int memberof_del_one(Slapi_PBlock *pb, MemberOfConfig *config, char *delthis, char *delfrom) { - return memberof_modop_one(pb, config, LDAP_MOD_DELETE, delthis, delfrom, txn); + return memberof_modop_one(pb, config, LDAP_MOD_DELETE, delthis, delfrom); }
/* @@ -1396,7 +1375,7 @@ int memberof_del_one(Slapi_PBlock *pb, MemberOfConfig *config, char *delthis, ch * */ int memberof_mod_smod_list(Slapi_PBlock *pb, MemberOfConfig *config, int mod, - char *group_dn, Slapi_Mod *smod, void *txn) + char *group_dn, Slapi_Mod *smod) { int rc = 0; struct berval *bv = slapi_mod_get_first_value(smod); @@ -1428,7 +1407,7 @@ int memberof_mod_smod_list(Slapi_PBlock *pb, MemberOfConfig *config, int mod,
strncpy(dn_str, bv->bv_val, (size_t)bv->bv_len);
- memberof_modop_one(pb, config, mod, group_dn, dn_str, txn); + memberof_modop_one(pb, config, mod, group_dn, dn_str);
bv = slapi_mod_get_next_value(smod); } @@ -1446,9 +1425,9 @@ int memberof_mod_smod_list(Slapi_PBlock *pb, MemberOfConfig *config, int mod, * */ int memberof_add_smod_list(Slapi_PBlock *pb, MemberOfConfig *config, - char *groupdn, Slapi_Mod *smod, void *txn) + char *groupdn, Slapi_Mod *smod) { - return memberof_mod_smod_list(pb, config, LDAP_MOD_ADD, groupdn, smod, txn); + return memberof_mod_smod_list(pb, config, LDAP_MOD_ADD, groupdn, smod); }
@@ -1459,9 +1438,9 @@ int memberof_add_smod_list(Slapi_PBlock *pb, MemberOfConfig *config, * */ int memberof_del_smod_list(Slapi_PBlock *pb, MemberOfConfig *config, - char *groupdn, Slapi_Mod *smod, void *txn) + char *groupdn, Slapi_Mod *smod) { - return memberof_mod_smod_list(pb, config, LDAP_MOD_DELETE, groupdn, smod, txn); + return memberof_mod_smod_list(pb, config, LDAP_MOD_DELETE, groupdn, smod); }
/** @@ -1485,13 +1464,13 @@ void * memberof_get_plugin_id() * */ int memberof_mod_attr_list(Slapi_PBlock *pb, MemberOfConfig *config, int mod, - char *group_dn, Slapi_Attr *attr, void *txn) + char *group_dn, Slapi_Attr *attr) { - return memberof_mod_attr_list_r(pb, config, mod, group_dn, group_dn, attr, 0, txn); + return memberof_mod_attr_list_r(pb, config, mod, group_dn, group_dn, attr, 0); }
int memberof_mod_attr_list_r(Slapi_PBlock *pb, MemberOfConfig *config, int mod, - char *group_dn, char *op_this, Slapi_Attr *attr, memberofstringll *stack, void *txn) + char *group_dn, char *op_this, Slapi_Attr *attr, memberofstringll *stack) { int rc = 0; Slapi_Value *val = 0; @@ -1538,11 +1517,11 @@ int memberof_mod_attr_list_r(Slapi_PBlock *pb, MemberOfConfig *config, int mod, if(mod == LDAP_MOD_REPLACE) { memberof_modop_one_replace_r(pb, config, mod, group_dn, op_this, - group_dn, dn_str, stack, txn); + group_dn, dn_str, stack); } else { - memberof_modop_one_r(pb, config, mod, group_dn, op_this, dn_str, stack, txn); + memberof_modop_one_r(pb, config, mod, group_dn, op_this, dn_str, stack); } }
@@ -1564,9 +1543,9 @@ int memberof_mod_attr_list_r(Slapi_PBlock *pb, MemberOfConfig *config, int mod, * */ int memberof_add_attr_list(Slapi_PBlock *pb, MemberOfConfig *config, char *groupdn, - Slapi_Attr *attr, void *txn) + Slapi_Attr *attr) { - return memberof_mod_attr_list(pb, config, LDAP_MOD_ADD, groupdn, attr, txn); + return memberof_mod_attr_list(pb, config, LDAP_MOD_ADD, groupdn, attr); }
/* @@ -1576,9 +1555,9 @@ int memberof_add_attr_list(Slapi_PBlock *pb, MemberOfConfig *config, char *group * */ int memberof_del_attr_list(Slapi_PBlock *pb, MemberOfConfig *config, char *groupdn, - Slapi_Attr *attr, void *txn) + Slapi_Attr *attr) { - return memberof_mod_attr_list(pb, config, LDAP_MOD_DELETE, groupdn, attr, txn); + return memberof_mod_attr_list(pb, config, LDAP_MOD_DELETE, groupdn, attr); }
/* @@ -1588,7 +1567,7 @@ int memberof_del_attr_list(Slapi_PBlock *pb, MemberOfConfig *config, char *group * */ int memberof_moddn_attr_list(Slapi_PBlock *pb, MemberOfConfig *config, - char *pre_dn, char *post_dn, Slapi_Attr *attr, void *txn) + char *pre_dn, char *post_dn, Slapi_Attr *attr) { int rc = 0; Slapi_Value *val = 0; @@ -1623,7 +1602,7 @@ int memberof_moddn_attr_list(Slapi_PBlock *pb, MemberOfConfig *config, strncpy(dn_str, bv->bv_val, (size_t)bv->bv_len);
memberof_modop_one_replace_r(pb, config, LDAP_MOD_REPLACE, - post_dn, pre_dn, post_dn, dn_str, 0, txn); + post_dn, pre_dn, post_dn, dn_str, 0);
hint = slapi_attr_next_value(attr, hint, &val); } @@ -1641,25 +1620,25 @@ 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(MemberOfConfig *config, char *memberdn, void *txn) +Slapi_ValueSet *memberof_get_groups(MemberOfConfig *config, char *memberdn) { Slapi_Value *memberdn_val = slapi_value_new_string(memberdn); Slapi_ValueSet *groupvals = slapi_valueset_new(); - memberof_get_groups_data data = {config, memberdn_val, &groupvals, txn}; + memberof_get_groups_data data = {config, memberdn_val, &groupvals};
- memberof_get_groups_r(config, memberdn, &data, txn); + memberof_get_groups_r(config, memberdn, &data);
slapi_value_free(&memberdn_val);
return groupvals; }
-int memberof_get_groups_r(MemberOfConfig *config, char *memberdn, memberof_get_groups_data *data, void *txn) +int memberof_get_groups_r(MemberOfConfig *config, char *memberdn, memberof_get_groups_data *data) { /* 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(NULL, memberdn, config->groupattrs, - memberof_get_groups_callback, data, txn); + memberof_get_groups_callback, data); }
/* memberof_get_groups_callback() @@ -1728,7 +1707,7 @@ int memberof_get_groups_callback(Slapi_Entry *e, void *callback_data)
/* now recurse to find parent groups of e */ memberof_get_groups_r(((memberof_get_groups_data*)callback_data)->config, - group_dn, callback_data, ((memberof_get_groups_data*)callback_data)->txn); + group_dn, callback_data);
bail: return rc; @@ -1740,7 +1719,7 @@ bail: * returns non-zero when true, zero otherwise */ int memberof_is_direct_member(MemberOfConfig *config, Slapi_Value *groupdn, - Slapi_Value *memberdn, void *txn) + Slapi_Value *memberdn) { int rc = 0; Slapi_DN *sdn = 0; @@ -1750,8 +1729,8 @@ int memberof_is_direct_member(MemberOfConfig *config, Slapi_Value *groupdn,
sdn = slapi_sdn_new_normdn_byref(slapi_value_get_string(groupdn));
- slapi_search_internal_get_entry_ext(sdn, config->groupattrs, - &group_e, memberof_get_plugin_id(), txn); + slapi_search_internal_get_entry(sdn, config->groupattrs, + &group_e, memberof_get_plugin_id());
if(group_e) { @@ -1798,11 +1777,6 @@ static int memberof_is_grouping_attr(char *type, MemberOfConfig *config) return match; }
-struct test_membership_cb_data { - MemberOfConfig *config; - void *txn; -}; - /* memberof_test_membership() * * Finds all entries who are a "memberOf" the group @@ -1818,13 +1792,12 @@ struct test_membership_cb_data { * iterate until a pass fails to move a group over to member groups * remaining groups should be deleted */ -int memberof_test_membership(Slapi_PBlock *pb, MemberOfConfig *config, char *group_dn, void *txn) +int memberof_test_membership(Slapi_PBlock *pb, MemberOfConfig *config, char *group_dn) { char *attrs[2] = {config->memberof_attr, 0}; - struct test_membership_cb_data cb_data = {config, txn};
return memberof_call_foreach_dn(pb, group_dn, attrs, - memberof_test_membership_callback , &cb_data, txn); + memberof_test_membership_callback , config); }
/* @@ -1842,8 +1815,7 @@ int memberof_test_membership_callback(Slapi_Entry *e, void *callback_data) Slapi_Value **member_array = 0; Slapi_Value **candidate_array = 0; Slapi_Value *entry_dn = 0; - struct test_membership_cb_data *cb_data = (struct test_membership_cb_data *)callback_data; - MemberOfConfig *config = cb_data->config; + MemberOfConfig *config = (MemberOfConfig *)callback_data;
entry_dn = slapi_value_new_string(slapi_entry_get_dn(e));
@@ -1880,7 +1852,7 @@ int memberof_test_membership_callback(Slapi_Entry *e, void *callback_data) while(val) { /* test for direct membership */ - if(memberof_is_direct_member(config, val, entry_dn, cb_data->txn)) + if(memberof_is_direct_member(config, val, entry_dn)) { /* it is a member */ member_array[m_index] = val; @@ -1929,7 +1901,7 @@ int memberof_test_membership_callback(Slapi_Entry *e, void *callback_data) if(memberof_is_direct_member( config, candidate_array[inner_index], - member_array[outer_index], cb_data->txn)) + member_array[outer_index])) { member_array[m_index] = candidate_array @@ -1969,7 +1941,7 @@ int memberof_test_membership_callback(Slapi_Entry *e, void *callback_data) 0, config, (char*)slapi_value_get_string( candidate_array[outer_index]), - (char*)slapi_value_get_string(entry_dn), cb_data->txn); + (char*)slapi_value_get_string(entry_dn));
outer_index++; } @@ -2001,7 +1973,7 @@ bail: * Perform replace the group DN list in the memberof attribute of the list of targets * */ -int memberof_replace_list(Slapi_PBlock *pb, MemberOfConfig *config, char *group_dn, void *txn) +int memberof_replace_list(Slapi_PBlock *pb, MemberOfConfig *config, char *group_dn) { struct slapi_entry *pre_e = NULL; struct slapi_entry *post_e = NULL; @@ -2091,7 +2063,7 @@ int memberof_replace_list(Slapi_PBlock *pb, MemberOfConfig *config, char *group_ pb, config, group_dn, (char*)slapi_value_get_string( - post_array[post_index]), txn); + post_array[post_index]));
post_index++; } @@ -2102,7 +2074,7 @@ int memberof_replace_list(Slapi_PBlock *pb, MemberOfConfig *config, char *group_ pb, config, group_dn, (char*)slapi_value_get_string( - pre_array[pre_index]), txn); + pre_array[pre_index]));
pre_index++; } @@ -2121,7 +2093,7 @@ int memberof_replace_list(Slapi_PBlock *pb, MemberOfConfig *config, char *group_ pb, config, group_dn, (char*)slapi_value_get_string( - pre_array[pre_index]), txn); + pre_array[pre_index]));
pre_index++; } @@ -2132,7 +2104,7 @@ int memberof_replace_list(Slapi_PBlock *pb, MemberOfConfig *config, char *group_ pb, config, group_dn, (char*)slapi_value_get_string( - post_array[post_index]), txn); + post_array[post_index]));
post_index++; } @@ -2252,7 +2224,7 @@ void memberof_fixup_task_thread(void *arg) memberof_lock();
/* do real work */ - rc = memberof_fix_memberof(&configCopy, td->dn, td->filter_str, NULL /* no txn? */); + rc = memberof_fix_memberof(&configCopy, td->dn, td->filter_str);
/* release the memberOf operation lock */ memberof_unlock(); @@ -2372,10 +2344,9 @@ memberof_task_destructor(Slapi_Task *task) } }
-int memberof_fix_memberof(MemberOfConfig *config, char *dn, char *filter_str, void *txn) +int memberof_fix_memberof(MemberOfConfig *config, char *dn, char *filter_str) { int rc = 0; - struct fix_memberof_callback_data cb_data = {config, txn}; Slapi_PBlock *search_pb = slapi_pblock_new();
slapi_search_internal_set_pb(search_pb, dn, @@ -2384,9 +2355,8 @@ int memberof_fix_memberof(MemberOfConfig *config, char *dn, char *filter_str, vo memberof_get_plugin_id(), 0);
- slapi_pblock_set(search_pb, SLAPI_TXN, txn); rc = slapi_search_internal_callback_pb(search_pb, - &cb_data, + config, 0, memberof_fix_memberof_callback, 0);
@@ -2407,13 +2377,12 @@ int memberof_fix_memberof_callback(Slapi_Entry *e, void *callback_data) int rc = 0; char *dn = slapi_entry_get_dn(e); 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 = {0, config->memberof_attr, cb_data->txn}; + MemberOfConfig *config = (MemberOfConfig *)callback_data; + memberof_del_dn_data del_data = {0, config->memberof_attr}; Slapi_ValueSet *groups = 0;
/* get a list of all of the groups this user belongs to */ - groups = memberof_get_groups(config, dn, cb_data->txn); + groups = memberof_get_groups(config, dn);
/* If we found some groups, replace the existing memberOf attribute * with the found values. */ @@ -2446,7 +2415,6 @@ int memberof_fix_memberof_callback(Slapi_Entry *e, void *callback_data) mod_pb, sdn, mods, 0, 0, memberof_get_plugin_id(), 0);
- slapi_pblock_set(mod_pb, SLAPI_TXN, cb_data->txn); slapi_modify_internal_pb(mod_pb);
slapi_pblock_get(mod_pb, SLAPI_PLUGIN_INTOP_RESULT, &rc);
commit 402289642004f6c51b591d9b22bdee33f592240e Author: Rich Megginson rmeggins@redhat.com Date: Thu Feb 16 17:08:23 2012 -0700
Revert "Change referential integrity to be a betxnpostoperation plugin"
This reverts commit d316a6717b18cba9826639d82116baa967734f35. keep the code that allows switching between a regular and a betxn plugin
diff --git a/ldap/servers/plugins/referint/referint.c b/ldap/servers/plugins/referint/referint.c index 4606de6..8ece438 100644 --- a/ldap/servers/plugins/referint/referint.c +++ b/ldap/servers/plugins/referint/referint.c @@ -77,7 +77,7 @@ 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(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 referint_thread_func(void *arg); int GetNextLine(char *dest, int size_dest, PRFileDesc *stream); void writeintegritylog(char *logfilename, Slapi_DN *sdn, char *newrdn, Slapi_DN *newsuperior, Slapi_DN *requestorsdn); @@ -165,12 +165,10 @@ referint_postop_del( Slapi_PBlock *pb ) int delay; int logChanges=0; int isrepop = 0; - void *txn = NULL;
if ( slapi_pblock_get( pb, SLAPI_IS_REPLICATED_OPERATION, &isrepop ) != 0 || - slapi_pblock_get( pb, SLAPI_DELETE_TARGET_SDN, &sdn ) != 0 || - slapi_pblock_get(pb, SLAPI_PLUGIN_OPRETURN, &oprc) != 0 || - slapi_pblock_get(pb, SLAPI_TXN, &txn) != 0) + slapi_pblock_get( pb, SLAPI_DELETE_TARGET_SDN, &sdn ) != 0 || + slapi_pblock_get(pb, SLAPI_PLUGIN_OPRETURN, &oprc) != 0) { slapi_log_error( SLAPI_LOG_FATAL, REFERINT_PLUGIN_SUBSYSTEM, "referint_postop_del: could not get parameters\n" ); @@ -215,7 +213,7 @@ referint_postop_del( Slapi_PBlock *pb ) }else if(delay == 0){ /* no delay */ /* call function to update references to entry */ - rc = update_integrity(argv, sdn, NULL, NULL, logChanges, txn); + rc = update_integrity(argv, sdn, NULL, NULL, logChanges); }else{ /* write the entry to integrity log */ writeintegritylog(argv[1], sdn, NULL, NULL, NULL /* slapi_get_requestor_sdn(pb) */); @@ -244,14 +242,12 @@ referint_postop_modrdn( Slapi_PBlock *pb ) int delay; int logChanges=0; int isrepop = 0; - void *txn = NULL;
if ( slapi_pblock_get( pb, SLAPI_IS_REPLICATED_OPERATION, &isrepop ) != 0 || slapi_pblock_get( pb, SLAPI_MODRDN_TARGET_SDN, &sdn ) != 0 || slapi_pblock_get( pb, SLAPI_MODRDN_NEWRDN, &newrdn ) != 0 || slapi_pblock_get( pb, SLAPI_MODRDN_NEWSUPERIOR_SDN, &newsuperior ) != 0 || - slapi_pblock_get(pb, SLAPI_PLUGIN_OPRETURN, &oprc) != 0 || - slapi_pblock_get(pb, SLAPI_TXN, &txn) != 0) { + slapi_pblock_get(pb, SLAPI_PLUGIN_OPRETURN, &oprc) != 0 ){
slapi_log_error( SLAPI_LOG_FATAL, REFERINT_PLUGIN_SUBSYSTEM, "referint_postop_modrdn: could not get parameters\n" ); @@ -301,7 +297,7 @@ referint_postop_modrdn( Slapi_PBlock *pb ) /* no delay */ /* call function to update references to entry */ rc = update_integrity(argv, sdn, newrdn, - newsuperior, logChanges, txn); + newsuperior, logChanges); }else{ /* write the entry to integrity log */ writeintegritylog(argv[1], sdn, newrdn, newsuperior, NULL /* slapi_get_requestor_sdn(pb) */); @@ -332,13 +328,11 @@ int isFatalSearchError(int search_result) }
static int -_do_modify(Slapi_PBlock *mod_pb, Slapi_DN *entrySDN, LDAPMod **mods, void *txn) +_do_modify(Slapi_PBlock *mod_pb, Slapi_DN *entrySDN, LDAPMod **mods) { int rc = 0;
slapi_pblock_init(mod_pb); - /* set the transaction to use */ - slapi_pblock_set(mod_pb, SLAPI_TXN, txn);
/* Use internal operation API */ slapi_modify_internal_set_pb_ext(mod_pb, entrySDN, mods, NULL, NULL, @@ -359,7 +353,7 @@ _update_one_per_mod(Slapi_DN *entrySDN, /* DN of the searched entry */ const char *origDN, /* original DN that was modified */ char *newRDN, /* new RDN from modrdn */ const char *newsuperior, /* new superior from modrdn */ - Slapi_PBlock *mod_pb, void *txn) + Slapi_PBlock *mod_pb) { LDAPMod *list_of_mods[3]; char *values_del[2]; @@ -382,7 +376,7 @@ _update_one_per_mod(Slapi_DN *entrySDN, /* DN of the searched entry */ list_of_mods[0] = &attribute1; /* terminate list of mods. */ list_of_mods[1] = NULL; - rc = _do_modify(mod_pb, entrySDN, list_of_mods, txn); + rc = _do_modify(mod_pb, entrySDN, list_of_mods); if (rc) { slapi_log_error( SLAPI_LOG_FATAL, REFERINT_PLUGIN_SUBSYSTEM, "_update_one_value: entry %s: deleting "%s: %s" failed (%d)" @@ -471,7 +465,7 @@ _update_one_per_mod(Slapi_DN *entrySDN, /* DN of the searched entry */ attribute2.mod_values = values_add; list_of_mods[1] = &attribute2; list_of_mods[2] = NULL; - rc = _do_modify(mod_pb, entrySDN, list_of_mods, txn); + rc = _do_modify(mod_pb, entrySDN, list_of_mods); if (rc) { slapi_log_error( SLAPI_LOG_FATAL, REFERINT_PLUGIN_SUBSYSTEM, "_update_one_value: entry %s: replacing "%s: %s" " @@ -501,7 +495,7 @@ _update_one_per_mod(Slapi_DN *entrySDN, /* DN of the searched entry */ attribute2.mod_values = values_add; list_of_mods[1] = &attribute2; list_of_mods[2] = NULL; - rc = _do_modify(mod_pb, entrySDN, list_of_mods, txn); + rc = _do_modify(mod_pb, entrySDN, list_of_mods); if (rc) { slapi_log_error( SLAPI_LOG_FATAL, REFERINT_PLUGIN_SUBSYSTEM, "_update_one_value: entry %s: replacing "%s: %s" " @@ -535,7 +529,7 @@ _update_all_per_mod(Slapi_DN *entrySDN, /* DN of the searched entry */ const char *origDN, /* original DN that was modified */ char *newRDN, /* new RDN from modrdn */ const char *newsuperior, /* new superior from modrdn */ - Slapi_PBlock *mod_pb, void *txn) + Slapi_PBlock *mod_pb) { Slapi_Mods *smods = NULL; char *newDN = NULL; @@ -562,7 +556,7 @@ _update_all_per_mod(Slapi_DN *entrySDN, /* DN of the searched entry */ mods[0] = &attribute1; /* terminate list of mods. */ mods[1] = NULL; - rc = _do_modify(mod_pb, entrySDN, mods, txn); + rc = _do_modify(mod_pb, entrySDN, mods); if (rc) { slapi_log_error( SLAPI_LOG_FATAL, REFERINT_PLUGIN_SUBSYSTEM, "_update_all_per_mod: entry %s: deleting "%s: %s" failed (%d)" @@ -654,7 +648,7 @@ _update_all_per_mod(Slapi_DN *entrySDN, /* DN of the searched entry */ /* else: value does not include the modified DN. Ignore it. */ slapi_ch_free_string(&sval); } - rc = _do_modify(mod_pb, entrySDN, slapi_mods_get_ldapmods_byref(smods), txn); + rc = _do_modify(mod_pb, entrySDN, slapi_mods_get_ldapmods_byref(smods)); if (rc) { slapi_log_error( SLAPI_LOG_FATAL, REFERINT_PLUGIN_SUBSYSTEM, "_update_all_per_mod: entry %s failed (%d)\n", @@ -676,7 +670,7 @@ bail: int update_integrity(char **argv, Slapi_DN *origSDN, char *newrDN, Slapi_DN *newsuperior, - int logChanges, void *txn) + int logChanges) { Slapi_PBlock *search_result_pb = NULL; Slapi_PBlock *mod_pb = slapi_pblock_new(); @@ -697,7 +691,7 @@ update_integrity(char **argv, Slapi_DN *origSDN, rc = -1; goto free_and_return; } - + /* for now, just putting attributes to keep integrity on in conf file, until resolve the other timing mode issue */ search_result_pb = slapi_pblock_new(); @@ -721,8 +715,6 @@ update_integrity(char **argv, Slapi_DN *origSDN,
/* Use new search API */ slapi_pblock_init(search_result_pb); - /* set the parent txn for the search ops */ - slapi_pblock_set(search_result_pb, SLAPI_TXN, txn); slapi_search_internal_set_pb(search_result_pb, search_base, LDAP_SCOPE_SUBTREE, filter, attrs, 0 /* attrs only */, NULL, NULL, referint_plugin_identity, 0); @@ -774,13 +766,13 @@ update_integrity(char **argv, Slapi_DN *origSDN, slapi_entry_get_sdn(search_entries[j]), attr, attrName, origDN, newrDN, slapi_sdn_get_dn(newsuperior), - mod_pb, txn); + mod_pb); } else { rc = _update_all_per_mod( slapi_entry_get_sdn(search_entries[j]), attr, attrName, origDN, newrDN, slapi_sdn_get_dn(newsuperior), - mod_pb, txn); + mod_pb); } /* Should we stop if one modify returns an error? */ } @@ -988,7 +980,7 @@ referint_thread_func(void *arg) }
update_integrity(plugin_argv, sdn, tmprdn, - tmpsuperior, logChanges, NULL); + tmpsuperior, logChanges);
slapi_sdn_free(&sdn); slapi_ch_free_string(&tmprdn);
commit dc9bfe9ffa73c85143a07927c74c933a1a62da45 Author: Rich Megginson rmeggins@redhat.com Date: Thu Feb 16 12:51:23 2012 -0700
Revert "Ticket #167 - Mixing transaction and non-transaction plugins can cause deadlock"
This reverts commit 77fdecc3a2bf6d9ce8e545ba0746f619fb14ce84 This is a partial revert. We still want to keep the code in the plugins that allows them to be either a regular plugin or a betxn plugin. All of the code that dealt with SLAPI_TXN and making sure all internal operations had SLAPI_TXN set is gone. 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).
diff --git a/ldap/servers/plugins/acctpolicy/acct_plugin.c b/ldap/servers/plugins/acctpolicy/acct_plugin.c index 5eb3d06..508fb23 100644 --- a/ldap/servers/plugins/acctpolicy/acct_plugin.c +++ b/ldap/servers/plugins/acctpolicy/acct_plugin.c @@ -90,7 +90,7 @@ done: with the current time. */ static int -acct_record_login( const char *dn, void *txn ) +acct_record_login( const char *dn ) { int ldrc; int rc = 0; /* Optimistic default */ @@ -126,7 +126,6 @@ acct_record_login( const char *dn, void *txn ) slapi_modify_internal_set_pb( modpb, dn, mods, NULL, NULL, plugin_id, SLAPI_OP_FLAG_NO_ACCESS_CHECK | SLAPI_OP_FLAG_BYPASS_REFERRALS ); - slapi_pblock_set( modpb, SLAPI_TXN, txn ); slapi_pblock_set( modpb, SLAPI_SKIP_MODIFIED_ATTRS, &skip_mod_attrs ); slapi_modify_internal_pb( modpb );
@@ -163,7 +162,6 @@ acct_bind_preop( Slapi_PBlock *pb ) int ldrc; acctPolicy *policy = NULL; void *plugin_id; - void *txn = NULL;
slapi_log_error( SLAPI_LOG_PLUGIN, PRE_PLUGIN_NAME, "=> acct_bind_preop\n" ); @@ -184,9 +182,8 @@ acct_bind_preop( Slapi_PBlock *pb ) goto done; }
- slapi_pblock_get(pb, SLAPI_TXN, &txn); - ldrc = slapi_search_internal_get_entry_ext( sdn, NULL, &target_entry, - plugin_id, txn ); + ldrc = slapi_search_internal_get_entry( sdn, NULL, &target_entry, + plugin_id );
/* There was a problem retrieving the entry */ if( ldrc != LDAP_SUCCESS ) { @@ -199,7 +196,7 @@ acct_bind_preop( Slapi_PBlock *pb ) goto done; }
- if( get_acctpolicy( pb, target_entry, plugin_id, &policy, txn ) ) { + if( get_acctpolicy( pb, target_entry, plugin_id, &policy ) ) { slapi_log_error( SLAPI_LOG_FATAL, PRE_PLUGIN_NAME, "Account Policy object for "%s" is missing\n", dn ); rc = -1; @@ -249,7 +246,6 @@ acct_bind_postop( Slapi_PBlock *pb ) Slapi_Entry *target_entry = NULL; acctPluginCfg *cfg; void *plugin_id; - void *txn = NULL;
slapi_log_error( SLAPI_LOG_PLUGIN, POST_PLUGIN_NAME, "=> acct_bind_postop\n" ); @@ -269,7 +265,6 @@ acct_bind_postop( Slapi_PBlock *pb ) goto done; }
- slapi_pblock_get(pb, SLAPI_TXN, &txn); cfg = get_config(); tracklogin = cfg->always_record_login;
@@ -277,8 +272,8 @@ acct_bind_postop( Slapi_PBlock *pb ) covered by an account policy to decide whether we should track */ if( tracklogin == 0 ) { sdn = slapi_sdn_new_normdn_byref( dn ); - ldrc = slapi_search_internal_get_entry_ext( sdn, NULL, &target_entry, - plugin_id, txn ); + ldrc = slapi_search_internal_get_entry( sdn, NULL, &target_entry, + plugin_id );
if( ldrc != LDAP_SUCCESS ) { slapi_log_error( SLAPI_LOG_FATAL, POST_PLUGIN_NAME, @@ -295,7 +290,7 @@ acct_bind_postop( Slapi_PBlock *pb ) }
if( tracklogin ) { - rc = acct_record_login( dn, txn ); + rc = acct_record_login( dn ); }
/* ...Any additional account policy postops go here... */ diff --git a/ldap/servers/plugins/acctpolicy/acct_util.c b/ldap/servers/plugins/acctpolicy/acct_util.c index c421746..8e220c3 100644 --- a/ldap/servers/plugins/acctpolicy/acct_util.c +++ b/ldap/servers/plugins/acctpolicy/acct_util.c @@ -78,7 +78,7 @@ get_attr_string_val( Slapi_Entry* target_entry, char* attr_name ) { */ int get_acctpolicy( Slapi_PBlock *pb, Slapi_Entry *target_entry, void *plugin_id, - acctPolicy **policy, void *txn ) { + acctPolicy **policy ) { Slapi_DN *sdn = NULL; Slapi_Entry *policy_entry = NULL; Slapi_Attr *attr; @@ -114,8 +114,8 @@ get_acctpolicy( Slapi_PBlock *pb, Slapi_Entry *target_entry, void *plugin_id, }
sdn = slapi_sdn_new_dn_byref( policy_dn ); - ldrc = slapi_search_internal_get_entry_ext( sdn, NULL, &policy_entry, - plugin_id, txn ); + ldrc = slapi_search_internal_get_entry( sdn, NULL, &policy_entry, + plugin_id ); slapi_sdn_free( &sdn );
/* There should be a policy but it can't be retrieved; fatal error */ diff --git a/ldap/servers/plugins/acctpolicy/acctpolicy.h b/ldap/servers/plugins/acctpolicy/acctpolicy.h index 0064009..e6f1497 100644 --- a/ldap/servers/plugins/acctpolicy/acctpolicy.h +++ b/ldap/servers/plugins/acctpolicy/acctpolicy.h @@ -65,7 +65,7 @@ typedef struct accountpolicy {
/* acct_util.c */ int get_acctpolicy( Slapi_PBlock *pb, Slapi_Entry *target_entry, - void *plugin_id, acctPolicy **policy, void *txn ); + void *plugin_id, acctPolicy **policy ); void free_acctpolicy( acctPolicy **policy ); int has_attr( Slapi_Entry* target_entry, char* attr_name, char** val ); diff --git a/ldap/servers/plugins/automember/automember.c b/ldap/servers/plugins/automember/automember.c index 92d5ae6..9dcc65a 100644 --- a/ldap/servers/plugins/automember/automember.c +++ b/ldap/servers/plugins/automember/automember.c @@ -84,9 +84,9 @@ static int automember_add_pre_op(Slapi_PBlock *pb); /* * Config cache management functions */ -static int automember_load_config(Slapi_PBlock *pb); +static int automember_load_config(); static void automember_delete_config(); -static int automember_parse_config_entry(Slapi_Entry * e, int apply, Slapi_PBlock *pb); +static int automember_parse_config_entry(Slapi_Entry * e, int apply); static void automember_free_config_entry(struct configEntry ** entry);
/* @@ -103,9 +103,9 @@ 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(struct configEntry *config, Slapi_Entry *e, void *txn); +static void automember_update_membership(struct configEntry *config, Slapi_Entry *e); static void automember_add_member_value(Slapi_Entry *member_e, const char *group_dn, - char *grouping_attr, char *grouping_value, void *txn); + char *grouping_attr, char *grouping_value);
/* * Config cache locking functions @@ -358,7 +358,7 @@ automember_start(Slapi_PBlock * pb) g_automember_config = (PRCList *)slapi_ch_calloc(1, sizeof(struct configEntry)); PR_INIT_CLIST(g_automember_config);
- if (automember_load_config(pb) != 0) { + if (automember_load_config() != 0) { slapi_log_error(SLAPI_LOG_FATAL, AUTOMEMBER_PLUGIN_SUBSYSTEM, "automember_start: unable to load plug-in configuration\n"); return -1; @@ -430,14 +430,13 @@ automember_get_config() * Parse and load the config entries. */ static int -automember_load_config(Slapi_PBlock *pb) +automember_load_config() { int status = 0; int result; int i; Slapi_PBlock *search_pb; Slapi_Entry **entries = NULL; - void *txn = NULL;
slapi_log_error(SLAPI_LOG_TRACE, AUTOMEMBER_PLUGIN_SUBSYSTEM, "--> automember_load_config\n"); @@ -446,7 +445,6 @@ automember_load_config(Slapi_PBlock *pb) automember_config_write_lock(); automember_delete_config();
- slapi_pblock_get(pb, SLAPI_TXN, &txn); search_pb = slapi_pblock_new();
/* If an alternate config area is configured, find @@ -473,7 +471,6 @@ automember_load_config(Slapi_PBlock *pb) NULL, 0, NULL, NULL, automember_get_plugin_id(), 0); }
- slapi_pblock_set(search_pb, SLAPI_TXN, txn); slapi_search_internal_pb(search_pb); slapi_pblock_get(search_pb, SLAPI_PLUGIN_INTOP_RESULT, &result);
@@ -500,7 +497,7 @@ automember_load_config(Slapi_PBlock *pb) /* We don't care about the status here because we may have * some invalid config entries, but we just want to continue * looking for valid ones. */ - automember_parse_config_entry(entries[i], 1, pb); + automember_parse_config_entry(entries[i], 1); }
cleanup: @@ -524,7 +521,7 @@ automember_load_config(Slapi_PBlock *pb) * Returns 0 if the entry is valid and -1 if it is invalid. */ static int -automember_parse_config_entry(Slapi_Entry * e, int apply, Slapi_PBlock *pb) +automember_parse_config_entry(Slapi_Entry * e, int apply) { char *value = NULL; char **values = NULL; @@ -539,7 +536,6 @@ automember_parse_config_entry(Slapi_Entry * e, int apply, Slapi_PBlock *pb) int entry_added = 0; int i = 0; int ret = 0; - void *txn = NULL;
slapi_log_error(SLAPI_LOG_TRACE, AUTOMEMBER_PLUGIN_SUBSYSTEM, "--> automember_parse_config_entry\n"); @@ -572,7 +568,6 @@ automember_parse_config_entry(Slapi_Entry * e, int apply, Slapi_PBlock *pb) goto bail; }
- slapi_pblock_get(pb, SLAPI_TXN, &txn); value = slapi_entry_get_ndn(e); if (value) { entry->dn = slapi_ch_strdup(value); @@ -665,7 +660,6 @@ automember_parse_config_entry(Slapi_Entry * e, int apply, Slapi_PBlock *pb) slapi_search_internal_set_pb(search_pb, entry->dn, LDAP_SCOPE_SUBTREE, AUTOMEMBER_REGEX_RULE_FILTER, NULL, 0, NULL, NULL, automember_get_plugin_id(), 0); - slapi_pblock_set(search_pb, SLAPI_TXN, txn); slapi_search_internal_pb(search_pb); slapi_pblock_get(search_pb, SLAPI_PLUGIN_INTOP_RESULT, &result);
@@ -1347,7 +1341,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(struct configEntry *config, Slapi_Entry *e, void *txn) +automember_update_membership(struct configEntry *config, Slapi_Entry *e) { PRCList *rule = NULL; struct automemberRegexRule *curr_rule = NULL; @@ -1501,14 +1495,14 @@ automember_update_membership(struct configEntry *config, Slapi_Entry *e, void *t /* Add to each default group. */ for (i = 0; config->default_groups && config->default_groups[i]; i++) { automember_add_member_value(e, config->default_groups[i], - config->grouping_attr, config->grouping_value, txn); + config->grouping_attr, config->grouping_value); } } else { /* Update the target groups. */ dnitem = (struct automemberDNListItem *)PR_LIST_HEAD(&targets); while ((PRCList *)dnitem != &targets) { automember_add_member_value(e, slapi_sdn_get_dn(dnitem->dn), - config->grouping_attr, config->grouping_value, txn); + config->grouping_attr, config->grouping_value); dnitem = (struct automemberDNListItem *)PR_NEXT_LINK((PRCList *)dnitem); } } @@ -1536,7 +1530,7 @@ automember_update_membership(struct configEntry *config, Slapi_Entry *e, void *t */ static void automember_add_member_value(Slapi_Entry *member_e, const char *group_dn, - char *grouping_attr, char *grouping_value, void *txn) + char *grouping_attr, char *grouping_value) { Slapi_PBlock *mod_pb = slapi_pblock_new(); int result = LDAP_SUCCESS; @@ -1572,7 +1566,6 @@ automember_add_member_value(Slapi_Entry *member_e, const char *group_dn,
slapi_modify_internal_set_pb(mod_pb, group_dn, mods, 0, 0, automember_get_plugin_id(), 0); - slapi_pblock_set(mod_pb, SLAPI_TXN, txn); slapi_modify_internal_pb(mod_pb); slapi_pblock_get(mod_pb, SLAPI_PLUGIN_INTOP_RESULT, &result);
@@ -1619,7 +1612,6 @@ automember_pre_op(Slapi_PBlock * pb, int modop) int free_entry = 0; char *errstr = NULL; int ret = 0; - void *txn = NULL;
slapi_log_error(SLAPI_LOG_TRACE, AUTOMEMBER_PLUGIN_SUBSYSTEM, "--> automember_pre_op\n"); @@ -1631,7 +1623,6 @@ automember_pre_op(Slapi_PBlock * pb, int modop) if (0 == (sdn = automember_get_sdn(pb))) goto bail;
- slapi_pblock_get(pb, SLAPI_TXN, &txn); if (automember_dn_is_config(sdn)) { /* Validate config changes, but don't apply them. * This allows us to reject invalid config changes @@ -1650,7 +1641,7 @@ automember_pre_op(Slapi_PBlock * pb, int modop) /* Fetch the entry being modified so we can * create the resulting entry for validation. */ if (sdn) { - slapi_search_internal_get_entry_ext(sdn, 0, &e, automember_get_plugin_id(), txn); + slapi_search_internal_get_entry(sdn, 0, &e, automember_get_plugin_id()); free_entry = 1; }
@@ -1678,7 +1669,7 @@ automember_pre_op(Slapi_PBlock * pb, int modop) goto bail; }
- if (automember_parse_config_entry(e, 0, pb) != 0) { + if (automember_parse_config_entry(e, 0) != 0) { /* Refuse the operation if config parsing failed. */ ret = LDAP_UNWILLING_TO_PERFORM; if (LDAP_CHANGETYPE_ADD == modop) { @@ -1748,7 +1739,7 @@ automember_mod_post_op(Slapi_PBlock *pb) if (automember_oktodo(pb) && (sdn = automember_get_sdn(pb))) { /* Check if the config is being modified and reload if so. */ if (automember_dn_is_config(sdn)) { - automember_load_config(pb); + automember_load_config(); } }
@@ -1766,7 +1757,6 @@ automember_add_post_op(Slapi_PBlock *pb) Slapi_DN *sdn = NULL; struct configEntry *config = NULL; PRCList *list = NULL; - void *txn = NULL;
slapi_log_error(SLAPI_LOG_TRACE, AUTOMEMBER_PLUGIN_SUBSYSTEM, "--> automember_add_post_op\n"); @@ -1778,7 +1768,7 @@ automember_add_post_op(Slapi_PBlock *pb) /* Reload config if a config entry was added. */ if ((sdn = automember_get_sdn(pb))) { if (automember_dn_is_config(sdn)) { - automember_load_config(pb); + automember_load_config(); } } else { slapi_log_error(SLAPI_LOG_PLUGIN, AUTOMEMBER_PLUGIN_SUBSYSTEM, @@ -1792,7 +1782,6 @@ automember_add_post_op(Slapi_PBlock *pb) return 0; }
- slapi_pblock_get(pb, SLAPI_TXN, &txn); /* Get the newly added entry. */ slapi_pblock_get(pb, SLAPI_ENTRY_POST_OP, &e);
@@ -1826,7 +1815,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(config, e, txn); + automember_update_membership(config, e); }
list = PR_NEXT_LINK(list); @@ -1867,7 +1856,7 @@ automember_del_post_op(Slapi_PBlock *pb) /* Reload config if a config entry was deleted. */ if ((sdn = automember_get_sdn(pb))) { if (automember_dn_is_config(sdn)) - automember_load_config(pb); + automember_load_config(); } else { slapi_log_error(SLAPI_LOG_PLUGIN, AUTOMEMBER_PLUGIN_SUBSYSTEM, "automember_del_post_op: Error " @@ -1915,7 +1904,7 @@ automember_modrdn_post_op(Slapi_PBlock *pb)
if ((old_sdn = automember_get_sdn(pb))) { if (automember_dn_is_config(old_sdn) || automember_dn_is_config(new_sdn)) - automember_load_config(pb); + automember_load_config(); } else { slapi_log_error(SLAPI_LOG_PLUGIN, AUTOMEMBER_PLUGIN_SUBSYSTEM, "automember_modrdn_post_op: Error " diff --git a/ldap/servers/plugins/deref/deref.c b/ldap/servers/plugins/deref/deref.c index 86055b2..fb6a54a 100644 --- a/ldap/servers/plugins/deref/deref.c +++ b/ldap/servers/plugins/deref/deref.c @@ -594,7 +594,6 @@ deref_do_deref_attr(Slapi_PBlock *pb, BerElement *ctrlber, const char *derefdn, Slapi_PBlock *derefpb = NULL; Slapi_Entry **entries = NULL; int rc; - void *txn = NULL;
if (deref_check_access(pb, NULL, derefdn, attrs, &retattrs, (SLAPI_ACL_SEARCH|SLAPI_ACL_READ))) { @@ -605,11 +604,10 @@ deref_do_deref_attr(Slapi_PBlock *pb, BerElement *ctrlber, const char *derefdn, }
derefpb = slapi_pblock_new(); - slapi_pblock_get(pb, SLAPI_TXN, &txn); slapi_search_internal_set_pb(derefpb, derefdn, LDAP_SCOPE_BASE, "(objectclass=*)", retattrs, 0, NULL, NULL, deref_get_plugin_id(), 0); - slapi_pblock_set(derefpb, SLAPI_TXN, txn); + slapi_search_internal_pb(derefpb); slapi_pblock_get(derefpb, SLAPI_PLUGIN_INTOP_RESULT, &rc); if (LDAP_SUCCESS == rc) { diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c index a422055..1173d50 100644 --- a/ldap/servers/plugins/dna/dna.c +++ b/ldap/servers/plugins/dna/dna.c @@ -231,15 +231,15 @@ 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(struct configEntry * config_entry, - char **next_value_ret, void *txn); + char **next_value_ret); static int dna_first_free_value(struct configEntry *config_entry, - PRUint64 *newval, void *txn); -static int dna_fix_maxval(struct configEntry *config_entry, void *txn); + PRUint64 *newval); +static int dna_fix_maxval(struct configEntry *config_entry); static void dna_notice_allocation(struct configEntry *config_entry, - PRUint64 new, PRUint64 last, int fix, void *txn); -static int dna_update_shared_config(struct configEntry * config_entry, void *txn); + PRUint64 new, PRUint64 last, int fix); +static int dna_update_shared_config(struct configEntry * config_entry); 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 int dna_get_shared_servers(struct configEntry *config_entry, PRCList **servers); static void dna_free_shared_server(struct dnaServer **server); static void dna_delete_shared_servers(PRCList **servers); static int dna_release_range(char *range_dn, PRUint64 *lower, PRUint64 *upper); @@ -248,8 +248,8 @@ static int dna_request_range(struct configEntry *config_entry, PRUint64 *lower, PRUint64 *upper); static struct berval *dna_create_range_request(char *range_dn); static int dna_update_next_range(struct configEntry *config_entry, - PRUint64 lower, PRUint64 upper, void *txn); -static int dna_activate_next_range(struct configEntry *config_entry, void *txn); + PRUint64 lower, PRUint64 upper); +static int dna_activate_next_range(struct configEntry *config_entry); 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, @@ -1308,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(config_entry, NULL); + dna_update_shared_config(config_entry);
slapi_unlock_mutex(config_entry->lock); slapi_pblock_init(pb); @@ -1336,7 +1336,7 @@ bail: * The lock for configEntry should be obtained * before calling this function. */ -static int dna_fix_maxval(struct configEntry *config_entry, void *txn) +static int dna_fix_maxval(struct configEntry *config_entry) { PRCList *servers = NULL; PRCList *server = NULL; @@ -1351,7 +1351,7 @@ static int dna_fix_maxval(struct configEntry *config_entry, void *txn) /* 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(config_entry, txn); + ret = dna_activate_next_range(config_entry); if (ret != 0) { slapi_log_error(SLAPI_LOG_FATAL, DNA_PLUGIN_SUBSYSTEM, "dna_fix_maxval: Unable to activate the " @@ -1360,7 +1360,7 @@ static int dna_fix_maxval(struct configEntry *config_entry, void *txn) } else if (config_entry->shared_cfg_base) { /* Find out if there are any other servers to request * range from. */ - dna_get_shared_servers(config_entry, &servers, txn); + dna_get_shared_servers(config_entry, &servers);
if (servers) { /* We have other servers we can try to extend @@ -1375,7 +1375,7 @@ static int dna_fix_maxval(struct configEntry *config_entry, void *txn) } else { /* Someone provided us with a new range. Attempt * to update the config. */ - if ((ret = dna_update_next_range(config_entry, lower, upper, txn)) == 0) { + if ((ret = dna_update_next_range(config_entry, lower, upper)) == 0) { break; } } @@ -1407,7 +1407,7 @@ bail: * this function. */ static void dna_notice_allocation(struct configEntry *config_entry, PRUint64 new, - PRUint64 last, int fix, void *txn) + PRUint64 last, int fix) { /* update our cached config entry */ if ((new != 0) && (new <= (config_entry->maxval + config_entry->interval))) { @@ -1421,7 +1421,7 @@ dna_notice_allocation(struct configEntry *config_entry, PRUint64 new, * new active range. */ if (config_entry->next_range_lower != 0) { /* Make the next range active */ - if (dna_activate_next_range(config_entry, txn) != 0) { + if (dna_activate_next_range(config_entry) != 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); @@ -1429,7 +1429,7 @@ dna_notice_allocation(struct configEntry *config_entry, PRUint64 new, } else { config_entry->remaining = 0; /* update the shared configuration */ - dna_update_shared_config(config_entry, txn); + dna_update_shared_config(config_entry); } } else { if (config_entry->next_range_lower != 0) { @@ -1442,7 +1442,7 @@ dna_notice_allocation(struct configEntry *config_entry, PRUint64 new, }
/* update the shared configuration */ - dna_update_shared_config(config_entry, txn); + dna_update_shared_config(config_entry); }
/* Check if we passed the threshold and try to fix maxval if so. We @@ -1454,7 +1454,7 @@ dna_notice_allocation(struct configEntry *config_entry, PRUint64 new, 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(config_entry, txn); + dna_fix_maxval(config_entry); } }
@@ -1462,7 +1462,7 @@ dna_notice_allocation(struct configEntry *config_entry, PRUint64 new, }
static int -dna_get_shared_servers(struct configEntry *config_entry, PRCList **servers, void *txn) +dna_get_shared_servers(struct configEntry *config_entry, PRCList **servers) { int ret = LDAP_SUCCESS; Slapi_PBlock *pb = NULL; @@ -1487,7 +1487,6 @@ dna_get_shared_servers(struct configEntry *config_entry, PRCList **servers, void LDAP_SCOPE_ONELEVEL, "objectclass=*", attrs, 0, NULL, NULL, getPluginID(), 0); - slapi_pblock_set(pb, SLAPI_TXN, txn); slapi_search_internal_pb(pb);
slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &ret); @@ -1872,7 +1871,7 @@ static LDAPControl *dna_build_sort_control(const char *attr) * maximum configured value for this range. */ static int dna_first_free_value(struct configEntry *config_entry, - PRUint64 *newval, void *txn) + PRUint64 *newval) { Slapi_Entry **entries = NULL; Slapi_PBlock *pb = NULL; @@ -1940,7 +1939,6 @@ dna_first_free_value(struct configEntry *config_entry, LDAP_SCOPE_SUBTREE, filter, config_entry->types, 0, ctrls, NULL, getPluginID(), 0); - slapi_pblock_set(pb, SLAPI_TXN, txn); slapi_search_internal_pb(pb);
slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &result); @@ -1980,7 +1978,6 @@ dna_first_free_value(struct configEntry *config_entry, config_entry->types, 0, 0, NULL, getPluginID(), 0);
- slapi_pblock_set(pb, SLAPI_TXN, txn); slapi_search_internal_pb(pb);
slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &result); @@ -2054,7 +2051,7 @@ cleanup: * Return the next value to be assigned */ static int dna_get_next_value(struct configEntry *config_entry, - char **next_value_ret, void *txn) + char **next_value_ret) { Slapi_PBlock *pb = NULL; LDAPMod mod_replace; @@ -2074,12 +2071,12 @@ static int dna_get_next_value(struct configEntry *config_entry, slapi_lock_mutex(config_entry->lock);
/* get the first value */ - ret = dna_first_free_value(config_entry, &setval, txn); + ret = dna_first_free_value(config_entry, &setval); if (LDAP_SUCCESS != ret) { /* check if we overflowed the configured range */ if (setval > config_entry->maxval) { /* try for a new range or fail */ - ret = dna_fix_maxval(config_entry, txn); + ret = dna_fix_maxval(config_entry); if (LDAP_SUCCESS != ret) { slapi_log_error(SLAPI_LOG_FATAL, DNA_PLUGIN_SUBSYSTEM, "dna_get_next_value: no more values available!!\n"); @@ -2087,7 +2084,7 @@ static int dna_get_next_value(struct configEntry *config_entry, }
/* get the first value from our newly extended range */ - ret = dna_first_free_value(config_entry, &setval, txn); + ret = dna_first_free_value(config_entry, &setval); if (LDAP_SUCCESS != ret) goto done; } else { @@ -2124,7 +2121,6 @@ static int dna_get_next_value(struct configEntry *config_entry, slapi_modify_internal_set_pb(pb, config_entry->dn, mods, 0, 0, getPluginID(), 0);
- slapi_pblock_set(pb, SLAPI_TXN, txn); slapi_modify_internal_pb(pb);
slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &ret); @@ -2139,7 +2135,7 @@ static int dna_get_next_value(struct configEntry *config_entry, }
/* update our cached config */ - dna_notice_allocation(config_entry, nextval, setval, 1, txn); + dna_notice_allocation(config_entry, nextval, setval, 1); }
done: @@ -2165,7 +2161,7 @@ static int dna_get_next_value(struct configEntry *config_entry, * before calling this function. * */ static int -dna_update_shared_config(struct configEntry * config_entry, void *txn) +dna_update_shared_config(struct configEntry * config_entry) { int ret = LDAP_SUCCESS;
@@ -2197,7 +2193,7 @@ dna_update_shared_config(struct configEntry * config_entry, void *txn) } else { slapi_modify_internal_set_pb(pb, config_entry->shared_cfg_dn, mods, NULL, NULL, getPluginID(), 0); - slapi_pblock_set(pb, SLAPI_TXN, txn); + slapi_modify_internal_pb(pb);
slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &ret); @@ -2228,7 +2224,6 @@ dna_update_shared_config(struct configEntry * config_entry, void *txn)
/* e will be consumed by slapi_add_internal() */ slapi_add_entry_internal_set_pb(pb, e, NULL, getPluginID(), 0); - slapi_pblock_set(pb, SLAPI_TXN, txn); slapi_add_internal_pb(pb); slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &ret); } @@ -2258,7 +2253,7 @@ dna_update_shared_config(struct configEntry * config_entry, void *txn) */ static int dna_update_next_range(struct configEntry *config_entry, - PRUint64 lower, PRUint64 upper, void *txn) + PRUint64 lower, PRUint64 upper) { Slapi_PBlock *pb = NULL; LDAPMod mod_replace; @@ -2289,7 +2284,7 @@ dna_update_next_range(struct configEntry *config_entry,
slapi_modify_internal_set_pb(pb, config_entry->dn, mods, 0, 0, getPluginID(), 0); - slapi_pblock_set(pb, SLAPI_TXN, txn); + slapi_modify_internal_pb(pb);
slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &ret); @@ -2305,7 +2300,7 @@ dna_update_next_range(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(config_entry, 0, 0, 0, txn); + dna_notice_allocation(config_entry, 0, 0, 0); }
bail: @@ -2322,7 +2317,7 @@ bail: * be obtained before calling this function. */ static int -dna_activate_next_range(struct configEntry *config_entry, void *txn) +dna_activate_next_range(struct configEntry *config_entry) { Slapi_PBlock *pb = NULL; LDAPMod mod_maxval; @@ -2371,7 +2366,7 @@ dna_activate_next_range(struct configEntry *config_entry, void *txn)
slapi_modify_internal_set_pb(pb, config_entry->dn, mods, 0, 0, getPluginID(), 0); - slapi_pblock_set(pb, SLAPI_TXN, txn); + slapi_modify_internal_pb(pb);
slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &ret); @@ -2392,7 +2387,7 @@ dna_activate_next_range(struct configEntry *config_entry, void *txn) config_entry->remaining = ((config_entry->maxval - config_entry->nextval + 1) / config_entry->interval); /* update the shared configuration */ - dna_update_shared_config(config_entry, txn); + dna_update_shared_config(config_entry); }
bail: @@ -2834,7 +2829,6 @@ static int dna_pre_op(Slapi_PBlock * pb, int modtype) char *errstr = NULL; int i = 0; int ret = 0; - void *txn = NULL;
slapi_log_error(SLAPI_LOG_TRACE, DNA_PLUGIN_SUBSYSTEM, "--> dna_pre_op\n"); @@ -2846,7 +2840,6 @@ static int dna_pre_op(Slapi_PBlock * pb, int modtype) if (0 == (dn = dna_get_dn(pb))) goto bail;
- slapi_pblock_get(pb, SLAPI_TXN, &txn); if (LDAP_CHANGETYPE_ADD == modtype) { slapi_pblock_get(pb, SLAPI_ADD_ENTRY, &e); } else { @@ -2863,7 +2856,7 @@ static int dna_pre_op(Slapi_PBlock * pb, int modtype) */ Slapi_DN *tmp_dn = dna_get_sdn(pb); if (tmp_dn) { - slapi_search_internal_get_entry_ext(tmp_dn, 0, &e, getPluginID(), txn); + slapi_search_internal_get_entry(tmp_dn, 0, &e, getPluginID()); free_entry = 1; }
@@ -3102,7 +3095,7 @@ static int dna_pre_op(Slapi_PBlock * pb, int modtype) int len;
/* create the value to add */ - ret = dna_get_next_value(config_entry, &value, txn); + ret = dna_get_next_value(config_entry, &value); if (DNA_SUCCESS != ret) { errstr = slapi_ch_smprintf("Allocation of a new value for range" " %s failed! Unable to proceed.", @@ -3475,7 +3468,7 @@ dna_release_range(char *range_dn, PRUint64 *lower, PRUint64 *upper)
/* Try to set the new next range in the config */ ret = dna_update_next_range(config_entry, config_entry->next_range_lower, - *lower - 1, NULL); + *lower - 1); } else { /* We release up to half of our remaining values, * but we'll only release a range that is a multiple @@ -3512,6 +3505,7 @@ dna_release_range(char *range_dn, PRUint64 *lower, PRUint64 *upper)
slapi_modify_internal_set_pb(pb, config_entry->dn, mods, 0, 0, getPluginID(), 0); + slapi_modify_internal_pb(pb);
slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &ret); @@ -3522,7 +3516,7 @@ dna_release_range(char *range_dn, PRUint64 *lower, PRUint64 *upper) if (ret == LDAP_SUCCESS) { /* Adjust maxval in our cached config and shared config */ config_entry->maxval = *lower - 1; - dna_notice_allocation(config_entry, config_entry->nextval, 0, 0, NULL); + dna_notice_allocation(config_entry, config_entry->nextval, 0, 0); } }
diff --git a/ldap/servers/plugins/linkedattrs/fixup_task.c b/ldap/servers/plugins/linkedattrs/fixup_task.c index c1af2f2..10c821b 100644 --- a/ldap/servers/plugins/linkedattrs/fixup_task.c +++ b/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(struct configEntry *config, void *txn); +static void linked_attrs_fixup_links(struct configEntry *config); 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, @@ -170,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(config_entry, NULL); + linked_attrs_fixup_links(config_entry); break; } } else { @@ -180,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(config_entry, NULL); + linked_attrs_fixup_links(config_entry); }
list = PR_NEXT_LINK(list); @@ -207,19 +207,12 @@ linked_attrs_fixup_task_thread(void *arg) slapi_task_finish(task, rc); }
-struct fixup_cb_data { - char *attrtype; - void *txn; - struct configEntry *config; -}; - static void -linked_attrs_fixup_links(struct configEntry *config, void *txn) +linked_attrs_fixup_links(struct configEntry *config) { Slapi_PBlock *pb = slapi_pblock_new(); char *del_filter = NULL; char *add_filter = 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); @@ -232,11 +225,8 @@ linked_attrs_fixup_links(struct configEntry *config, void *txn) * within the scope and remove the managed type. */ slapi_search_internal_set_pb(pb, config->scope, LDAP_SCOPE_SUBTREE, del_filter, 0, 0, 0, 0, linked_attrs_get_plugin_id(), 0); - slapi_pblock_set(pb, SLAPI_TXN, txn);
- cb_data.attrtype = config->managedtype; - cb_data.txn = txn; - slapi_search_internal_callback_pb(pb, &cb_data, 0, + slapi_search_internal_callback_pb(pb, config->managedtype, 0, linked_attrs_remove_backlinks_callback, 0);
/* Clean out pblock for reuse. */ @@ -246,12 +236,8 @@ linked_attrs_fixup_links(struct configEntry *config, void *txn) * scope and add backlinks to the entries they point to. */ slapi_search_internal_set_pb(pb, config->scope, LDAP_SCOPE_SUBTREE, add_filter, 0, 0, 0, 0, linked_attrs_get_plugin_id(), 0); - slapi_pblock_set(pb, SLAPI_TXN, txn);
- cb_data.attrtype = NULL; - cb_data.txn = txn; - cb_data.config = config; - slapi_search_internal_callback_pb(pb, &cb_data, 0, + slapi_search_internal_callback_pb(pb, config, 0, linked_attrs_add_backlinks_callback, 0); } else { /* Loop through all non-private backend suffixes and @@ -266,10 +252,7 @@ linked_attrs_fixup_links(struct configEntry *config, void *txn) LDAP_SCOPE_SUBTREE, del_filter, 0, 0, 0, 0, linked_attrs_get_plugin_id(), 0); - slapi_pblock_set(pb, SLAPI_TXN, txn);
- cb_data.attrtype = config->managedtype; - cb_data.txn = txn; slapi_search_internal_callback_pb(pb, config->managedtype, 0, linked_attrs_remove_backlinks_callback, 0);
@@ -280,11 +263,8 @@ linked_attrs_fixup_links(struct configEntry *config, void *txn) LDAP_SCOPE_SUBTREE, add_filter, 0, 0, 0, 0, linked_attrs_get_plugin_id(), 0); - slapi_pblock_set(pb, SLAPI_TXN, txn); - cb_data.attrtype = NULL; - cb_data.txn = txn; - cb_data.config = config; - slapi_search_internal_callback_pb(pb, &cb_data, 0, + + slapi_search_internal_callback_pb(pb, config, 0, linked_attrs_add_backlinks_callback, 0);
/* Clean out pblock for reuse. */ @@ -307,8 +287,7 @@ linked_attrs_remove_backlinks_callback(Slapi_Entry *e, void *callback_data) { int rc = 0; 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; + char *type = (char *)callback_data; Slapi_PBlock *pb = slapi_pblock_new(); char *val[1]; LDAPMod mod; @@ -331,7 +310,6 @@ linked_attrs_remove_backlinks_callback(Slapi_Entry *e, void *callback_data) /* Perform the operation. */ slapi_modify_internal_set_pb_ext(pb, sdn, mods, 0, 0, linked_attrs_get_plugin_id(), 0); - slapi_pblock_set(pb, SLAPI_TXN, cb_data->txn); slapi_modify_internal_pb(pb);
slapi_pblock_destroy(pb); @@ -344,8 +322,7 @@ linked_attrs_add_backlinks_callback(Slapi_Entry *e, void *callback_data) { int rc = 0; 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; + struct configEntry *config = (struct configEntry *)callback_data; Slapi_PBlock *pb = slapi_pblock_new(); int i = 0; char **targets = NULL; @@ -401,7 +378,6 @@ linked_attrs_add_backlinks_callback(Slapi_Entry *e, void *callback_data) /* Perform the modify operation. */ slapi_modify_internal_set_pb_ext(pb, targetsdn, mods, 0, 0, linked_attrs_get_plugin_id(), 0); - slapi_pblock_set(pb, SLAPI_TXN, cb_data->txn); slapi_modify_internal_pb(pb);
/* Initialize the pblock so we can reuse it. */ diff --git a/ldap/servers/plugins/linkedattrs/linked_attrs.c b/ldap/servers/plugins/linkedattrs/linked_attrs.c index ccc067c..ff3dc3a 100644 --- a/ldap/servers/plugins/linkedattrs/linked_attrs.c +++ b/ldap/servers/plugins/linkedattrs/linked_attrs.c @@ -107,13 +107,13 @@ 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(char *linkdn, struct configEntry *config, - Slapi_Mod *smod, void *txn); + Slapi_Mod *smod); 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(char *linkdn, char *type, char *scope, - int modop, Slapi_ValueSet *targetvals, void *txn); + int modop, Slapi_ValueSet *targetvals);
/* * Config cache locking functions @@ -1255,13 +1255,13 @@ linked_attrs_compare(const void *a, const void *b) */ static void linked_attrs_add_backpointers(char *linkdn, struct configEntry *config, - Slapi_Mod *smod, void *txn) + Slapi_Mod *smod) { Slapi_ValueSet *vals = slapi_valueset_new();
slapi_valueset_set_from_smod(vals, smod); linked_attrs_mod_backpointers(linkdn, config->managedtype, config->scope, - LDAP_MOD_ADD, vals, txn); + LDAP_MOD_ADD, vals);
slapi_valueset_free(vals); } @@ -1277,7 +1277,6 @@ linked_attrs_del_backpointers(Slapi_PBlock *pb, char *linkdn, struct configEntry *config, Slapi_Mod *smod) { Slapi_ValueSet *vals = NULL; - void *txn = NULL;
/* If no values are listed in the smod, we need to get * a list of all of the values that were deleted by @@ -1294,9 +1293,8 @@ linked_attrs_del_backpointers(Slapi_PBlock *pb, char *linkdn, slapi_valueset_set_from_smod(vals, smod); }
- slapi_pblock_get(pb, SLAPI_TXN, &txn); linked_attrs_mod_backpointers(linkdn, config->managedtype, config->scope, - LDAP_MOD_DELETE, vals, txn); + LDAP_MOD_DELETE, vals);
slapi_valueset_free(vals); } @@ -1317,7 +1315,6 @@ linked_attrs_replace_backpointers(Slapi_PBlock *pb, char *linkdn, Slapi_Entry *post_e = NULL; Slapi_Attr *pre_attr = 0; Slapi_Attr *post_attr = 0; - void *txn = NULL;
/* Get the pre and post copy of the entry to see * what values have been added and removed. */ @@ -1328,7 +1325,6 @@ linked_attrs_replace_backpointers(Slapi_PBlock *pb, char *linkdn, slapi_entry_attr_find(pre_e, config->linktype, &pre_attr); slapi_entry_attr_find(post_e, config->linktype, &post_attr); } - slapi_pblock_get(pb, SLAPI_TXN, &txn);
if(pre_attr || post_attr) { int pre_total = 0; @@ -1415,13 +1411,13 @@ linked_attrs_replace_backpointers(Slapi_PBlock *pb, char *linkdn, /* Perform the actual updates to the target entries. */ if (delvals) { linked_attrs_mod_backpointers(linkdn, config->managedtype, - config->scope, LDAP_MOD_DELETE, delvals, txn); + config->scope, LDAP_MOD_DELETE, delvals); slapi_valueset_free(delvals); }
if (addvals) { linked_attrs_mod_backpointers(linkdn, config->managedtype, - config->scope, LDAP_MOD_ADD, addvals, txn); + config->scope, LDAP_MOD_ADD, addvals); slapi_valueset_free(addvals); }
@@ -1437,7 +1433,7 @@ linked_attrs_replace_backpointers(Slapi_PBlock *pb, char *linkdn, */ static void linked_attrs_mod_backpointers(char *linkdn, char *type, - char *scope, int modop, Slapi_ValueSet *targetvals, void *txn) + char *scope, int modop, Slapi_ValueSet *targetvals) { char *val[2]; int i = 0; @@ -1490,7 +1486,6 @@ linked_attrs_mod_backpointers(char *linkdn, char *type, /* Perform the modify operation. */ slapi_modify_internal_set_pb_ext(mod_pb, targetsdn, mods, 0, 0, linked_attrs_get_plugin_id(), 0); - slapi_pblock_set(mod_pb, SLAPI_TXN, txn); slapi_modify_internal_pb(mod_pb);
/* Initialize the pblock so we can reuse it. */ @@ -1524,7 +1519,6 @@ linked_attrs_pre_op(Slapi_PBlock * pb, int modop) int free_entry = 0; char *errstr = NULL; int ret = 0; - void *txn = NULL;
slapi_log_error(SLAPI_LOG_TRACE, LINK_PLUGIN_SUBSYSTEM, "--> linked_attrs_pre_op\n"); @@ -1536,7 +1530,6 @@ linked_attrs_pre_op(Slapi_PBlock * pb, int modop) if (0 == (dn = linked_attrs_get_dn(pb))) goto bail;
- slapi_pblock_get(pb, SLAPI_TXN, &txn); if (linked_attrs_dn_is_config(dn)) { /* Validate config changes, but don't apply them. * This allows us to reject invalid config changes @@ -1551,7 +1544,7 @@ linked_attrs_pre_op(Slapi_PBlock * pb, int modop) /* int free_sdn = 0; */ Slapi_DN *tmp_dn = linked_attrs_get_sdn(pb); if (tmp_dn) { - slapi_search_internal_get_entry_ext(tmp_dn, 0, &e, linked_attrs_get_plugin_id(), txn); + slapi_search_internal_get_entry(tmp_dn, 0, &e, linked_attrs_get_plugin_id()); free_entry = 1; }
@@ -1623,7 +1616,6 @@ linked_attrs_mod_post_op(Slapi_PBlock *pb) char *dn = NULL; struct configEntry *config = NULL; void *caller_id = NULL; - void *txn = NULL;
slapi_log_error(SLAPI_LOG_TRACE, LINK_PLUGIN_SUBSYSTEM, "--> linked_attrs_mod_post_op\n"); @@ -1641,7 +1633,6 @@ linked_attrs_mod_post_op(Slapi_PBlock *pb) /* Just return without processing */ return 0; } - slapi_pblock_get(pb, SLAPI_TXN, &txn);
if (linked_attrs_oktodo(pb) && (dn = linked_attrs_get_dn(pb))) { @@ -1684,7 +1675,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(dn, config, smod, txn); + linked_attrs_add_backpointers(dn, config, smod); break; case LDAP_MOD_DELETE: /* Find the entries pointed to by the deleted @@ -1728,7 +1719,6 @@ linked_attrs_add_post_op(Slapi_PBlock *pb) { Slapi_Entry *e = NULL; char *dn = NULL; - void *txn = NULL;
slapi_log_error(SLAPI_LOG_TRACE, LINK_PLUGIN_SUBSYSTEM, "--> linked_attrs_add_post_op\n"); @@ -1747,7 +1737,6 @@ linked_attrs_add_post_op(Slapi_PBlock *pb) "retrieving dn\n"); }
- slapi_pblock_get(pb, SLAPI_TXN, &txn); /* Get the newly added entry. */ slapi_pblock_get(pb, SLAPI_ENTRY_POST_OP, &e);
@@ -1780,7 +1769,7 @@ linked_attrs_add_post_op(Slapi_PBlock *pb) slapi_lock_mutex(config->lock);
linked_attrs_mod_backpointers(dn, config->managedtype, - config->scope, LDAP_MOD_ADD, vals, txn); + config->scope, LDAP_MOD_ADD, vals);
slapi_unlock_mutex(config->lock);
@@ -1809,7 +1798,6 @@ linked_attrs_del_post_op(Slapi_PBlock *pb) { char *dn = NULL; Slapi_Entry *e = NULL; - void *txn = NULL;
slapi_log_error(SLAPI_LOG_TRACE, LINK_PLUGIN_SUBSYSTEM, "--> linked_attrs_del_post_op\n"); @@ -1818,7 +1806,6 @@ linked_attrs_del_post_op(Slapi_PBlock *pb) if (!g_plugin_started || !linked_attrs_oktodo(pb)) return 0;
- slapi_pblock_get(pb, SLAPI_TXN, &txn); /* Reload config if a config entry was deleted. */ if ((dn = linked_attrs_get_dn(pb))) { if (linked_attrs_dn_is_config(dn)) @@ -1861,7 +1848,7 @@ linked_attrs_del_post_op(Slapi_PBlock *pb) slapi_lock_mutex(config->lock);
linked_attrs_mod_backpointers(dn, config->managedtype, - config->scope, LDAP_MOD_DELETE, vals, txn); + config->scope, LDAP_MOD_DELETE, vals);
slapi_unlock_mutex(config->lock);
@@ -1890,7 +1877,7 @@ linked_attrs_del_post_op(Slapi_PBlock *pb)
/* Delete forward link value. */ linked_attrs_mod_backpointers(dn, config->linktype, - config->scope, LDAP_MOD_DELETE, vals, txn); + config->scope, LDAP_MOD_DELETE, vals);
slapi_unlock_mutex(config->lock);
@@ -1928,7 +1915,6 @@ linked_attrs_modrdn_post_op(Slapi_PBlock *pb) char *type = NULL; struct configEntry *config = NULL; int rc = 0; - void *txn = NULL;
slapi_log_error(SLAPI_LOG_TRACE, LINK_PLUGIN_SUBSYSTEM, "--> linked_attrs_modrdn_post_op\n"); @@ -1938,7 +1924,6 @@ linked_attrs_modrdn_post_op(Slapi_PBlock *pb) goto done; }
- slapi_pblock_get(pb, SLAPI_TXN, &txn); /* Reload config if an existing config entry was renamed, * or if the new dn brings an entry into the scope of the * config entries. */ @@ -1991,7 +1976,7 @@ linked_attrs_modrdn_post_op(Slapi_PBlock *pb)
/* Delete old dn value. */ linked_attrs_mod_backpointers(old_dn, config->managedtype, - config->scope, LDAP_MOD_DELETE, vals, txn); + config->scope, LDAP_MOD_DELETE, vals);
slapi_unlock_mutex(config->lock);
@@ -2014,7 +1999,7 @@ linked_attrs_modrdn_post_op(Slapi_PBlock *pb)
/* Add new dn value. */ linked_attrs_mod_backpointers(new_dn, config->managedtype, - config->scope, LDAP_MOD_ADD, vals, txn); + config->scope, LDAP_MOD_ADD, vals);
slapi_unlock_mutex(config->lock);
@@ -2043,11 +2028,11 @@ linked_attrs_modrdn_post_op(Slapi_PBlock *pb)
/* Delete old dn value. */ linked_attrs_mod_backpointers(old_dn, config->linktype, - config->scope, LDAP_MOD_DELETE, vals, txn); + config->scope, LDAP_MOD_DELETE, vals);
/* Add new dn value. */ linked_attrs_mod_backpointers(new_dn, config->linktype, - config->scope, LDAP_MOD_ADD, vals, txn); + config->scope, LDAP_MOD_ADD, vals);
slapi_unlock_mutex(config->lock);
diff --git a/ldap/servers/plugins/mep/mep.c b/ldap/servers/plugins/mep/mep.c index 303d9b3..b51c241 100644 --- a/ldap/servers/plugins/mep/mep.c +++ b/ldap/servers/plugins/mep/mep.c @@ -87,9 +87,9 @@ static int mep_modrdn_pre_op(Slapi_PBlock *pb); /* * Config cache management functions */ -static int mep_load_config(Slapi_PBlock *pb); +static int mep_load_config(); static void mep_delete_config(); -static int mep_parse_config_entry(Slapi_Entry * e, int apply, Slapi_PBlock *pb); +static int mep_parse_config_entry(Slapi_Entry * e, int apply); static void mep_free_config_entry(struct configEntry ** entry);
/* @@ -108,9 +108,9 @@ 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(struct configEntry *config, - Slapi_Entry *origin, void *txn); + Slapi_Entry *origin); static void mep_rename_managed_entry(Slapi_Entry *origin, - Slapi_DN *new_dn, Slapi_DN *old_dn, void *txn); + Slapi_DN *new_dn, Slapi_DN *old_dn); static Slapi_Mods *mep_get_mapped_mods(struct configEntry *config, Slapi_Entry *origin, char **mapped_dn); static int mep_parse_mapped_attr(char *mapping, Slapi_Entry *origin, @@ -374,7 +374,7 @@ mep_start(Slapi_PBlock * pb) g_mep_config = (PRCList *)slapi_ch_calloc(1, sizeof(struct configEntry)); PR_INIT_CLIST(g_mep_config);
- if (mep_load_config(pb) != 0) { + if (mep_load_config() != 0) { slapi_log_error(SLAPI_LOG_FATAL, MEP_PLUGIN_SUBSYSTEM, "mep_start: unable to load plug-in configuration\n"); return -1; @@ -442,14 +442,13 @@ mep_get_config() * --- cn=etc,... */ static int -mep_load_config(Slapi_PBlock *pb) +mep_load_config() { int status = 0; int result; int i; Slapi_PBlock *search_pb; Slapi_Entry **entries = NULL; - void *txn = NULL;
slapi_log_error(SLAPI_LOG_TRACE, MEP_PLUGIN_SUBSYSTEM, "--> mep_load_config\n"); @@ -484,8 +483,6 @@ mep_load_config(Slapi_PBlock *pb) NULL, 0, NULL, NULL, mep_get_plugin_id(), 0); }
- slapi_pblock_get(pb, SLAPI_TXN, &txn); - slapi_pblock_set(search_pb, SLAPI_TXN, txn); slapi_search_internal_pb(search_pb); slapi_pblock_get(search_pb, SLAPI_PLUGIN_INTOP_RESULT, &result);
@@ -509,7 +506,7 @@ mep_load_config(Slapi_PBlock *pb) /* We don't care about the status here because we may have * some invalid config entries, but we just want to continue * looking for valid ones. */ - mep_parse_config_entry(entries[i], 1, pb); + mep_parse_config_entry(entries[i], 1); }
cleanup: @@ -533,7 +530,7 @@ mep_load_config(Slapi_PBlock *pb) * Returns 0 if the entry is valid and -1 if it is invalid. */ static int -mep_parse_config_entry(Slapi_Entry * e, int apply, Slapi_PBlock *pb) +mep_parse_config_entry(Slapi_Entry * e, int apply) { char *value; struct configEntry *entry = NULL; @@ -541,7 +538,6 @@ mep_parse_config_entry(Slapi_Entry * e, int apply, Slapi_PBlock *pb) PRCList *list; int entry_added = 0; int ret = 0; - void *txn = NULL;
slapi_log_error(SLAPI_LOG_TRACE, MEP_PLUGIN_SUBSYSTEM, "--> mep_parse_config_entry\n"); @@ -573,7 +569,6 @@ mep_parse_config_entry(Slapi_Entry * e, int apply, Slapi_PBlock *pb) slapi_log_error(SLAPI_LOG_CONFIG, MEP_PLUGIN_SUBSYSTEM, "----------> dn [%s]\n", slapi_sdn_get_dn(entry->sdn));
- slapi_pblock_get(pb, SLAPI_TXN, &txn); /* Load the origin scope */ value = slapi_entry_attr_get_charptr(e, MEP_SCOPE_TYPE); if (value) { @@ -634,8 +629,8 @@ mep_parse_config_entry(Slapi_Entry * e, int apply, Slapi_PBlock *pb) entry->template_sdn = slapi_sdn_new_dn_byval(value);
/* Fetch the managed entry template */ - slapi_search_internal_get_entry_ext(entry->template_sdn, 0, - &entry->template_entry, mep_get_plugin_id(), txn); + slapi_search_internal_get_entry(entry->template_sdn, 0, + &entry->template_entry, mep_get_plugin_id());
if (entry->template_entry == NULL) { slapi_log_error(SLAPI_LOG_FATAL, MEP_PLUGIN_SUBSYSTEM, @@ -1423,7 +1418,7 @@ mep_create_managed_entry(struct configEntry *config, Slapi_Entry *origin) */ static void mep_add_managed_entry(struct configEntry *config, - Slapi_Entry *origin, void *txn) + Slapi_Entry *origin) { Slapi_Entry *managed_entry = NULL; char *managed_dn = NULL; @@ -1453,7 +1448,6 @@ mep_add_managed_entry(struct configEntry *config, "entry "%s"\n.", managed_dn, slapi_entry_get_dn(origin)); slapi_add_entry_internal_set_pb(mod_pb, managed_entry, NULL, mep_get_plugin_id(), 0); - slapi_pblock_set(mod_pb, SLAPI_TXN, txn); slapi_add_internal_pb(mod_pb); slapi_pblock_get(mod_pb, SLAPI_PLUGIN_INTOP_RESULT, &result);
@@ -1499,7 +1493,6 @@ mep_add_managed_entry(struct configEntry *config, slapi_modify_internal_set_pb_ext(mod_pb, slapi_entry_get_sdn(origin), mods, 0, 0, mep_get_plugin_id(), 0); - slapi_pblock_set(mod_pb, SLAPI_TXN, txn); slapi_modify_internal_pb(mod_pb); slapi_pblock_get(mod_pb, SLAPI_PLUGIN_INTOP_RESULT, &result);
@@ -1524,7 +1517,7 @@ mep_add_managed_entry(struct configEntry *config, */ static void mep_rename_managed_entry(Slapi_Entry *origin, - Slapi_DN *new_dn, Slapi_DN *old_dn, void *txn) + Slapi_DN *new_dn, Slapi_DN *old_dn) { Slapi_RDN *srdn = slapi_rdn_new(); Slapi_PBlock *mep_pb = slapi_pblock_new(); @@ -1545,7 +1538,6 @@ mep_rename_managed_entry(Slapi_Entry *origin, slapi_rename_internal_set_pb_ext(mep_pb, old_dn, slapi_rdn_get_rdn(srdn), NULL, 1, NULL, NULL, mep_get_plugin_id(), 0); - slapi_pblock_set(mep_pb, SLAPI_TXN, txn); slapi_modrdn_internal_pb(mep_pb); slapi_pblock_get(mep_pb, SLAPI_PLUGIN_INTOP_RESULT, &result);
@@ -1574,7 +1566,6 @@ mep_rename_managed_entry(Slapi_Entry *origin, vals[0], slapi_entry_get_dn(origin)); slapi_modify_internal_set_pb_ext(mep_pb, slapi_entry_get_sdn(origin), mods, 0, 0, mep_get_plugin_id(), 0); - slapi_pblock_set(mep_pb, SLAPI_TXN, txn); slapi_modify_internal_pb(mep_pb); slapi_pblock_get(mep_pb, SLAPI_PLUGIN_INTOP_RESULT, &result);
@@ -1993,7 +1984,6 @@ mep_pre_op(Slapi_PBlock * pb, int modop) struct configEntry *config = NULL; void *caller_id = NULL; int ret = 0; - void *txn = NULL;
slapi_log_error(SLAPI_LOG_TRACE, MEP_PLUGIN_SUBSYSTEM, "--> mep_pre_op\n"); @@ -2008,7 +1998,6 @@ mep_pre_op(Slapi_PBlock * pb, int modop) if (0 == (sdn = mep_get_sdn(pb))) goto bail;
- slapi_pblock_get(pb, SLAPI_TXN, &txn); if (mep_dn_is_config(sdn)) { /* Validate config changes, but don't apply them. * This allows us to reject invalid config changes @@ -2022,7 +2011,7 @@ mep_pre_op(Slapi_PBlock * pb, int modop) /* Fetch the entry being modified so we can * create the resulting entry for validation. */ if (sdn) { - slapi_search_internal_get_entry_ext(sdn, 0, &e, mep_get_plugin_id(), txn); + slapi_search_internal_get_entry(sdn, 0, &e, mep_get_plugin_id()); free_entry = 1; }
@@ -2053,7 +2042,7 @@ mep_pre_op(Slapi_PBlock * pb, int modop) goto bail; }
- if (mep_parse_config_entry(e, 0, pb) != 0) { + if (mep_parse_config_entry(e, 0) != 0) { /* Refuse the operation if config parsing failed. */ ret = LDAP_UNWILLING_TO_PERFORM; if (LDAP_CHANGETYPE_ADD == modop) { @@ -2105,7 +2094,7 @@ mep_pre_op(Slapi_PBlock * pb, int modop) case LDAP_CHANGETYPE_MODIFY: /* Fetch the existing template entry. */ if (sdn) { - slapi_search_internal_get_entry_ext(sdn, 0, &e, mep_get_plugin_id(), txn); + slapi_search_internal_get_entry(sdn, 0, &e, mep_get_plugin_id()); free_entry = 1; }
@@ -2173,7 +2162,7 @@ mep_pre_op(Slapi_PBlock * pb, int modop) slapi_entry_free(e); }
- slapi_search_internal_get_entry_ext(sdn, 0, &e, mep_get_plugin_id(), txn); + slapi_search_internal_get_entry(sdn, 0, &e, mep_get_plugin_id()); free_entry = 1; }
@@ -2183,8 +2172,8 @@ mep_pre_op(Slapi_PBlock * pb, int modop) origin_dn = slapi_entry_attr_get_charptr(e, MEP_MANAGED_BY_TYPE); if (origin_dn) { origin_sdn = slapi_sdn_new_normdn_byref(origin_dn); - slapi_search_internal_get_entry_ext(origin_sdn, 0, - &origin_e, mep_get_plugin_id(), txn); + slapi_search_internal_get_entry(origin_sdn, 0, + &origin_e, mep_get_plugin_id()); slapi_sdn_free(&origin_sdn); }
@@ -2315,7 +2304,6 @@ mep_mod_post_op(Slapi_PBlock *pb) Slapi_DN *mapped_sdn = NULL; struct configEntry *config = NULL; int result = 0; - void *txn = NULL; LDAPMod **mods = NULL; int i, abort_mod = 1;
@@ -2326,11 +2314,10 @@ mep_mod_post_op(Slapi_PBlock *pb) if (!g_plugin_started) return 0;
- slapi_pblock_get(pb, SLAPI_TXN, &txn); if (mep_oktodo(pb) && (sdn = mep_get_sdn(pb))) { /* First check if the config or a template is being modified. */ if (mep_dn_is_config(sdn) || mep_dn_is_template(sdn)) { - mep_load_config(pb); + mep_load_config(); }
/* If replication, just bail. */ @@ -2401,7 +2388,6 @@ mep_mod_post_op(Slapi_PBlock *pb) slapi_modify_internal_set_pb(mep_pb, managed_dn, slapi_mods_get_ldapmods_byref(smods), 0, 0, mep_get_plugin_id(), 0); - slapi_pblock_set(mep_pb, SLAPI_TXN, txn); slapi_modify_internal_pb(mep_pb); slapi_pblock_get(mep_pb, SLAPI_PLUGIN_INTOP_RESULT, &result);
@@ -2423,7 +2409,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(e, mapped_sdn, managed_sdn, txn); + mep_rename_managed_entry(e, mapped_sdn, managed_sdn); }
slapi_sdn_free(&mapped_sdn); @@ -2452,7 +2438,6 @@ mep_add_post_op(Slapi_PBlock *pb) Slapi_Entry *e = NULL; Slapi_DN *sdn = NULL; struct configEntry *config = NULL; - void *txn = NULL;
slapi_log_error(SLAPI_LOG_TRACE, MEP_PLUGIN_SUBSYSTEM, "--> mep_add_post_op\n"); @@ -2461,11 +2446,10 @@ mep_add_post_op(Slapi_PBlock *pb) if (!g_plugin_started || !mep_oktodo(pb)) return 0;
- slapi_pblock_get(pb, SLAPI_TXN, &txn); /* Reload config if a config entry was added. */ if ((sdn = mep_get_sdn(pb))) { if (mep_dn_is_config(sdn)) { - mep_load_config(pb); + mep_load_config(); } } else { slapi_log_error(SLAPI_LOG_PLUGIN, MEP_PLUGIN_SUBSYSTEM, @@ -2499,7 +2483,7 @@ mep_add_post_op(Slapi_PBlock *pb)
mep_find_config(e, &config); if (config) { - mep_add_managed_entry(config, e, txn); + mep_add_managed_entry(config, e); }
mep_config_unlock(); @@ -2520,7 +2504,6 @@ mep_del_post_op(Slapi_PBlock *pb) { Slapi_Entry *e = NULL; Slapi_DN *sdn = NULL; - void *txn = NULL;
slapi_log_error(SLAPI_LOG_TRACE, MEP_PLUGIN_SUBSYSTEM, "--> mep_del_post_op\n"); @@ -2533,7 +2516,7 @@ mep_del_post_op(Slapi_PBlock *pb) /* Reload config if a config entry was deleted. */ if ((sdn = mep_get_sdn(pb))) { if (mep_dn_is_config(sdn)) - mep_load_config(pb); + mep_load_config(); } else { slapi_log_error(SLAPI_LOG_PLUGIN, MEP_PLUGIN_SUBSYSTEM, "mep_del_post_op: Error " @@ -2545,7 +2528,6 @@ mep_del_post_op(Slapi_PBlock *pb) return 0; }
- slapi_pblock_get(pb, SLAPI_TXN, &txn); /* Get deleted entry, then go through types to find config. */ slapi_pblock_get( pb, SLAPI_ENTRY_PRE_OP, &e );
@@ -2569,7 +2551,6 @@ mep_del_post_op(Slapi_PBlock *pb) ""%s".\n ", managed_dn, slapi_sdn_get_dn(sdn)); slapi_delete_internal_set_pb(mep_pb, managed_dn, NULL, NULL, mep_get_plugin_id(), 0); - slapi_pblock_set(mep_pb, SLAPI_TXN, txn); slapi_delete_internal_pb(mep_pb);
slapi_ch_free_string(&managed_dn); @@ -2596,7 +2577,6 @@ mep_modrdn_post_op(Slapi_PBlock *pb) Slapi_Entry *post_e = NULL; char *managed_dn = NULL; struct configEntry *config = NULL; - void *txn = NULL;
slapi_log_error(SLAPI_LOG_TRACE, MEP_PLUGIN_SUBSYSTEM, "--> mep_modrdn_post_op\n"); @@ -2619,10 +2599,9 @@ mep_modrdn_post_op(Slapi_PBlock *pb) return 0; }
- slapi_pblock_get(pb, SLAPI_TXN, &txn); if ((old_sdn = mep_get_sdn(pb))) { if (mep_dn_is_config(old_sdn) || mep_dn_is_config(new_sdn)) - mep_load_config(pb); + mep_load_config(); } else { slapi_log_error(SLAPI_LOG_PLUGIN, MEP_PLUGIN_SUBSYSTEM, "mep_modrdn_post_op: Error " @@ -2673,7 +2652,6 @@ mep_modrdn_post_op(Slapi_PBlock *pb) managed_dn, slapi_sdn_get_dn(old_sdn)); slapi_delete_internal_set_pb (mep_pb, managed_dn, NULL, NULL, mep_get_plugin_id(), 0); - slapi_pblock_set(mep_pb, SLAPI_TXN, txn); slapi_delete_internal_pb(mep_pb);
/* Clear out the pblock for reuse. */ @@ -2703,7 +2681,6 @@ mep_modrdn_post_op(Slapi_PBlock *pb) MEP_MANAGED_ENTRY_TYPE, MEP_ORIGIN_OC, new_dn); slapi_modify_internal_set_pb_ext(mep_pb, new_sdn, mods, 0, 0, mep_get_plugin_id(), 0); - slapi_pblock_set(mep_pb, SLAPI_TXN, txn); slapi_modify_internal_pb(mep_pb); slapi_pblock_get(mep_pb, SLAPI_PLUGIN_INTOP_RESULT, &result);
@@ -2741,8 +2718,8 @@ mep_modrdn_post_op(Slapi_PBlock *pb) * perform our updates. */ managed_sdn = slapi_sdn_new_normdn_byref(managed_dn);
- if (slapi_search_internal_get_entry_ext(managed_sdn, 0, - NULL, mep_get_plugin_id(), txn) == LDAP_NO_SUCH_OBJECT) { + if (slapi_search_internal_get_entry(managed_sdn, 0, + NULL, mep_get_plugin_id()) == LDAP_NO_SUCH_OBJECT) { slapi_ch_free_string(&managed_dn); /* This DN is not a copy, so we don't want to free it later. */ managed_dn = slapi_entry_get_dn(new_managed_entry); @@ -2756,7 +2733,6 @@ mep_modrdn_post_op(Slapi_PBlock *pb) "in entry "%s".\n", MEP_MANAGED_BY_TYPE, new_dn, managed_dn); slapi_modify_internal_set_pb(mep_pb, managed_dn, mods, 0, 0, mep_get_plugin_id(), 0); - slapi_pblock_set(mep_pb, SLAPI_TXN, txn); slapi_modify_internal_pb(mep_pb); slapi_pblock_get(mep_pb, SLAPI_PLUGIN_INTOP_RESULT, &result);
@@ -2777,7 +2753,7 @@ mep_modrdn_post_op(Slapi_PBlock *pb) slapi_sdn_get_dn(old_sdn)); mep_rename_managed_entry(post_e, slapi_entry_get_sdn(new_managed_entry), - managed_sdn, txn); + managed_sdn); }
/* Update all of the mapped attributes @@ -2795,7 +2771,6 @@ mep_modrdn_post_op(Slapi_PBlock *pb) slapi_entry_get_sdn(new_managed_entry), slapi_mods_get_ldapmods_byref(smods), 0, 0, mep_get_plugin_id(), 0); - slapi_pblock_set(mep_pb, SLAPI_TXN, txn); slapi_modify_internal_pb(mep_pb); slapi_pblock_get(mep_pb, SLAPI_PLUGIN_INTOP_RESULT, &result);
@@ -2838,7 +2813,7 @@ bailmod:
mep_find_config(post_e, &config); if (config) { - mep_add_managed_entry(config, post_e, txn); + mep_add_managed_entry(config, post_e); }
mep_config_unlock(); diff --git a/ldap/servers/plugins/replication/urp.c b/ldap/servers/plugins/replication/urp.c index 33be252..1328996 100644 --- a/ldap/servers/plugins/replication/urp.c +++ b/ldap/servers/plugins/replication/urp.c @@ -53,10 +53,10 @@ extern int slapi_log_urp;
static int urp_add_resolve_parententry (Slapi_PBlock *pb, char *sessionid, Slapi_Entry *entry, Slapi_Entry *parententry, CSN *opcsn); -static int urp_annotate_dn (char *sessionid, Slapi_Entry *entry, CSN *opcsn, const char *optype, void *txn); +static int urp_annotate_dn (char *sessionid, Slapi_Entry *entry, CSN *opcsn, const char *optype); static int urp_naming_conflict_removal (Slapi_PBlock *pb, char *sessionid, CSN *opcsn, const char *optype); -static int mod_namingconflict_attr (const char *uniqueid, const Slapi_DN *entrysdn, const Slapi_DN *conflictsdn, CSN *opcsn, void *txn); -static int del_replconflict_attr (Slapi_Entry *entry, CSN *opcsn, int opflags, void *txn); +static int mod_namingconflict_attr (const char *uniqueid, const Slapi_DN *entrysdn, const Slapi_DN *conflictsdn, CSN *opcsn); +static int del_replconflict_attr (Slapi_Entry *entry, CSN *opcsn, int opflags); static char *get_dn_plus_uniqueid(char *sessionid,const char *olddn,const char *uniqueid); static char *get_rdn_plus_uniqueid(char *sessionid,const char *olddn,const char *uniqueid); static int is_suffix_entry (Slapi_PBlock *pb, Slapi_Entry *entry, Slapi_DN **parenddn); @@ -123,14 +123,12 @@ urp_add_operation( Slapi_PBlock *pb ) int op_result= 0; int rc= 0; /* OK */ Slapi_DN *sdn = NULL; - void *txn = NULL;
if ( slapi_op_abandoned(pb) ) { return rc; }
- slapi_pblock_get( pb, SLAPI_TXN, &txn ); slapi_pblock_get( pb, SLAPI_ADD_EXISTING_UNIQUEID_ENTRY, &existing_uniqueid_entry ); if (existing_uniqueid_entry!=NULL) { @@ -229,7 +227,7 @@ urp_add_operation( Slapi_PBlock *pb ) else if(r>0) { /* Existing entry is a loser */ - if (!urp_annotate_dn(sessionid, existing_dn_entry, opcsn, "ADD", txn)) + if (!urp_annotate_dn(sessionid, existing_dn_entry, opcsn, "ADD")) { op_result= LDAP_OPERATIONS_ERROR; slapi_pblock_set(pb, SLAPI_RESULT_CODE, &op_result); @@ -288,14 +286,12 @@ urp_modrdn_operation( Slapi_PBlock *pb ) int op_result= 0; int rc= 0; /* OK */ int del_old_replconflict_attr = 0; - void *txn = NULL;
if ( slapi_op_abandoned(pb) ) { return rc; }
- slapi_pblock_get (pb, SLAPI_TXN, &txn); slapi_pblock_get (pb, SLAPI_MODRDN_TARGET_ENTRY, &target_entry); if(target_entry==NULL) { @@ -421,7 +417,7 @@ urp_modrdn_operation( Slapi_PBlock *pb ) Unique ID already in RDN - Change to Lost and Found entry */ goto bailout; } - mod_namingconflict_attr (op_uniqueid, target_sdn, existing_sdn, opcsn, txn); + mod_namingconflict_attr (op_uniqueid, target_sdn, existing_sdn, opcsn); slapi_pblock_set(pb, SLAPI_MODRDN_NEWRDN, newrdn_with_uniqueid); slapi_log_error(slapi_log_urp, sessionid, "Naming conflict MODRDN. Rename target entry to %s\n", @@ -436,7 +432,7 @@ urp_modrdn_operation( Slapi_PBlock *pb ) { /* The existing entry is a loser */
- int resolve = urp_annotate_dn (sessionid, existing_entry, opcsn, "MODRDN", txn); + int resolve = urp_annotate_dn (sessionid, existing_entry, opcsn, "MODRDN"); if(!resolve) { op_result= LDAP_OPERATIONS_ERROR; @@ -547,7 +543,7 @@ urp_modrdn_operation( Slapi_PBlock *pb ) bailout: if ( del_old_replconflict_attr && rc == 0 ) { - del_replconflict_attr (target_entry, opcsn, 0, txn); + del_replconflict_attr (target_entry, opcsn, 0); } if ( parentdn ) slapi_sdn_free(&parentdn); @@ -565,14 +561,12 @@ urp_delete_operation( Slapi_PBlock *pb ) char sessionid[REPL_SESSION_ID_SIZE]; int op_result= 0; int rc= 0; /* OK */ - void *txn = NULL;
if ( slapi_op_abandoned(pb) ) { return rc; }
- slapi_pblock_get(pb, SLAPI_TXN, &txn); slapi_pblock_get(pb, SLAPI_DELETE_EXISTING_ENTRY, &deleteentry);
if(deleteentry==NULL) /* uniqueid can't be found */ @@ -598,14 +592,14 @@ urp_delete_operation( Slapi_PBlock *pb ) if(!slapi_entry_has_children(deleteentry)) { /* Remove possible conflict attributes */ - del_replconflict_attr (deleteentry, opcsn, 0, txn); + del_replconflict_attr (deleteentry, opcsn, 0); rc= 0; /* OK, to delete the entry */ PROFILE_POINT; /* Delete Operation; OK. */ } else { /* Turn this entry into a glue_absent_parent entry */ - entry_to_glue(sessionid, deleteentry, REASON_RESURRECT_ENTRY, opcsn, txn); + entry_to_glue(sessionid, deleteentry, REASON_RESURRECT_ENTRY, opcsn);
/* Turn the Delete into a No-Op */ op_result= LDAP_SUCCESS; @@ -718,7 +712,7 @@ urp_post_delete_operation( Slapi_PBlock *pb ) }
int -urp_fixup_add_entry (Slapi_Entry *e, const char *target_uniqueid, const char *parentuniqueid, CSN *opcsn, int opflags, void *txn) +urp_fixup_add_entry (Slapi_Entry *e, const char *target_uniqueid, const char *parentuniqueid, CSN *opcsn, int opflags) { Slapi_PBlock *newpb; Slapi_Operation *op; @@ -749,7 +743,6 @@ urp_fixup_add_entry (Slapi_Entry *e, const char *target_uniqueid, const char *pa slapi_pblock_get ( newpb, SLAPI_OPERATION, &op ); operation_set_csn ( op, opcsn );
- slapi_pblock_set ( newpb, SLAPI_TXN, txn ); slapi_add_internal_pb ( newpb ); slapi_pblock_get ( newpb, SLAPI_PLUGIN_INTOP_RESULT, &op_result ); slapi_pblock_destroy ( newpb ); @@ -758,7 +751,7 @@ urp_fixup_add_entry (Slapi_Entry *e, const char *target_uniqueid, const char *pa }
int -urp_fixup_rename_entry (Slapi_Entry *entry, const char *newrdn, int opflags, void *txn) +urp_fixup_rename_entry (Slapi_Entry *entry, const char *newrdn, int opflags) { Slapi_PBlock *newpb; Slapi_Operation *op; @@ -787,7 +780,6 @@ urp_fixup_rename_entry (Slapi_Entry *entry, const char *newrdn, int opflags, voi slapi_pblock_get (newpb, SLAPI_OPERATION, &op); operation_set_csn (op, opcsn);
- slapi_pblock_set(newpb, SLAPI_TXN, txn); slapi_modrdn_internal_pb(newpb); slapi_pblock_get(newpb, SLAPI_PLUGIN_INTOP_RESULT, &op_result);
@@ -796,7 +788,7 @@ urp_fixup_rename_entry (Slapi_Entry *entry, const char *newrdn, int opflags, voi }
int -urp_fixup_delete_entry (const char *uniqueid, const char *dn, CSN *opcsn, int opflags, void *txn) +urp_fixup_delete_entry (const char *uniqueid, const char *dn, CSN *opcsn, int opflags) { Slapi_PBlock *newpb; Slapi_Operation *op; @@ -818,7 +810,6 @@ urp_fixup_delete_entry (const char *uniqueid, const char *dn, CSN *opcsn, int op slapi_pblock_get ( newpb, SLAPI_OPERATION, &op ); operation_set_csn ( op, opcsn );
- slapi_pblock_set ( newpb, SLAPI_TXN, txn ); slapi_delete_internal_pb ( newpb ); slapi_pblock_get ( newpb, SLAPI_PLUGIN_INTOP_RESULT, &op_result ); slapi_pblock_destroy ( newpb ); @@ -827,7 +818,7 @@ urp_fixup_delete_entry (const char *uniqueid, const char *dn, CSN *opcsn, int op }
int -urp_fixup_modify_entry (const char *uniqueid, const Slapi_DN *sdn, CSN *opcsn, Slapi_Mods *smods, int opflags, void *txn) +urp_fixup_modify_entry (const char *uniqueid, const Slapi_DN *sdn, CSN *opcsn, Slapi_Mods *smods, int opflags) { Slapi_PBlock *newpb; Slapi_Operation *op; @@ -848,7 +839,6 @@ urp_fixup_modify_entry (const char *uniqueid, const Slapi_DN *sdn, CSN *opcsn, S slapi_pblock_get (newpb, SLAPI_OPERATION, &op); operation_set_csn (op, opcsn);
- slapi_pblock_set (newpb, SLAPI_TXN, txn); /* do modify */ slapi_modify_internal_pb (newpb); slapi_pblock_get (newpb, SLAPI_PLUGIN_INTOP_RESULT, &op_result); @@ -972,7 +962,7 @@ bailout: * a new entry (the operation entry) see urp_add_operation. */ static int -urp_annotate_dn (char *sessionid, Slapi_Entry *entry, CSN *opcsn, const char *optype, void *txn) +urp_annotate_dn (char *sessionid, Slapi_Entry *entry, CSN *opcsn, const char *optype) { int rc = 0; /* Fail */ int op_result; @@ -988,8 +978,8 @@ urp_annotate_dn (char *sessionid, Slapi_Entry *entry, CSN *opcsn, const char *op newrdn = get_rdn_plus_uniqueid ( sessionid, basedn, uniqueid ); if(newrdn!=NULL) { - mod_namingconflict_attr (uniqueid, basesdn, basesdn, opcsn, txn); - op_result = urp_fixup_rename_entry ( entry, newrdn, 0, txn ); + mod_namingconflict_attr (uniqueid, basesdn, basesdn, opcsn); + op_result = urp_fixup_rename_entry ( entry, newrdn, 0 ); switch(op_result) { case LDAP_SUCCESS: @@ -1051,9 +1041,7 @@ urp_get_min_naming_conflict_entry ( Slapi_PBlock *pb, char *sessionid, CSN *opcs int i = 0; int min_i = -1; int op_result = LDAP_SUCCESS; - void *txn = NULL;
- slapi_pblock_get (pb, SLAPI_TXN, &txn); slapi_pblock_get (pb, SLAPI_URP_NAMING_COLLISION_DN, &basedn); if (NULL == basedn || strncmp (basedn, SLAPI_ATTR_UNIQUEID, strlen(SLAPI_ATTR_UNIQUEID)) == 0) return NULL; @@ -1080,7 +1068,6 @@ urp_get_min_naming_conflict_entry ( Slapi_PBlock *pb, char *sessionid, CSN *opcs NULL, /* UniqueID */ repl_get_plugin_identity(PLUGIN_MULTIMASTER_REPLICATION), 0); - slapi_pblock_set(newpb, SLAPI_TXN, txn); slapi_search_internal_pb(newpb); slapi_pblock_get(newpb, SLAPI_PLUGIN_INTOP_RESULT, &op_result); slapi_pblock_get(newpb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &entries); @@ -1146,9 +1133,6 @@ urp_naming_conflict_removal ( Slapi_PBlock *pb, char *sessionid, CSN *opcsn, con Slapi_RDN *oldrdn, *newrdn; const char *oldrdnstr, *newrdnstr; int op_result; - void *txn = NULL; - - slapi_pblock_get (pb, SLAPI_TXN, &txn);
/* * Backend op has set SLAPI_URP_NAMING_COLLISION_DN to the basedn. @@ -1174,7 +1158,7 @@ urp_naming_conflict_removal ( Slapi_PBlock *pb, char *sessionid, CSN *opcsn, con * is done after DB lock was released. The backend modrdn * will acquire the DB lock if it sees this flag. */ - op_result = urp_fixup_rename_entry (min_naming_conflict_entry, newrdnstr, OP_FLAG_ACTION_INVOKE_FOR_REPLOP, txn); + op_result = urp_fixup_rename_entry (min_naming_conflict_entry, newrdnstr, OP_FLAG_ACTION_INVOKE_FOR_REPLOP); if ( op_result != LDAP_SUCCESS ) { slapi_log_error (slapi_log_urp, sessionid, @@ -1189,7 +1173,7 @@ urp_naming_conflict_removal ( Slapi_PBlock *pb, char *sessionid, CSN *opcsn, con * A fixup op will not invoke urp_modrdn_operation(). Even it does, * urp_modrdn_operation() will do nothing because of the same CSN. */ - op_result = del_replconflict_attr (min_naming_conflict_entry, opcsn, OP_FLAG_ACTION_INVOKE_FOR_REPLOP, txn); + op_result = del_replconflict_attr (min_naming_conflict_entry, opcsn, OP_FLAG_ACTION_INVOKE_FOR_REPLOP); if (op_result != LDAP_SUCCESS) { slapi_log_error(SLAPI_LOG_REPL, sessionid, "Failed to remove nsds5ReplConflict for %s, err=%d\n", @@ -1293,7 +1277,7 @@ is_suffix_dn ( Slapi_PBlock *pb, const Slapi_DN *dn, Slapi_DN **parentdn )
static int mod_namingconflict_attr (const char *uniqueid, const Slapi_DN *entrysdn, - const Slapi_DN *conflictsdn, CSN *opcsn, void *txn) + const Slapi_DN *conflictsdn, CSN *opcsn) { Slapi_Mods smods; char buf[BUFSIZ]; @@ -1316,13 +1300,13 @@ mod_namingconflict_attr (const char *uniqueid, const Slapi_DN *entrysdn, */ slapi_mods_add (&smods, LDAP_MOD_REPLACE, ATTR_NSDS5_REPLCONFLICT, strlen(buf), buf); } - op_result = urp_fixup_modify_entry (uniqueid, entrysdn, opcsn, &smods, 0, txn); + op_result = urp_fixup_modify_entry (uniqueid, entrysdn, opcsn, &smods, 0); slapi_mods_done (&smods); return op_result; }
static int -del_replconflict_attr (Slapi_Entry *entry, CSN *opcsn, int opflags, void *txn) +del_replconflict_attr (Slapi_Entry *entry, CSN *opcsn, int opflags) { Slapi_Attr *attr; int op_result = 0; @@ -1337,7 +1321,7 @@ del_replconflict_attr (Slapi_Entry *entry, CSN *opcsn, int opflags, void *txn) entrysdn = slapi_entry_get_sdn_const (entry); slapi_mods_init (&smods, 2); slapi_mods_add (&smods, LDAP_MOD_DELETE, ATTR_NSDS5_REPLCONFLICT, 0, NULL); - op_result = urp_fixup_modify_entry (uniqueid, entrysdn, opcsn, &smods, opflags, txn); + op_result = urp_fixup_modify_entry (uniqueid, entrysdn, opcsn, &smods, opflags); slapi_mods_done (&smods); } return op_result; diff --git a/ldap/servers/plugins/replication/urp.h b/ldap/servers/plugins/replication/urp.h index 77ac8a4..2ca7ad2 100644 --- a/ldap/servers/plugins/replication/urp.h +++ b/ldap/servers/plugins/replication/urp.h @@ -57,10 +57,10 @@ int urp_modrdn_operation( Slapi_PBlock *pb ); int urp_post_modrdn_operation( Slapi_PBlock *pb );
/* urp internal ops */ -int urp_fixup_add_entry (Slapi_Entry *e, const char *target_uniqueid, const char *parentuniqueid, CSN *opcsn, int opflags, void *txn); -int urp_fixup_delete_entry (const char *uniqueid, const char *dn, CSN *opcsn, int opflags, void *txn); -int urp_fixup_rename_entry (Slapi_Entry *entry, const char *newrdn, int opflags, void *txn); -int urp_fixup_modify_entry (const char *uniqueid, const Slapi_DN *sdn, CSN *opcsn, Slapi_Mods *smods, int opflags, void *txn); +int urp_fixup_add_entry (Slapi_Entry *e, const char *target_uniqueid, const char *parentuniqueid, CSN *opcsn, int opflags); +int urp_fixup_delete_entry (const char *uniqueid, const char *dn, CSN *opcsn, int opflags); +int urp_fixup_rename_entry (Slapi_Entry *entry, const char *newrdn, int opflags); +int urp_fixup_modify_entry (const char *uniqueid, const Slapi_DN *sdn, CSN *opcsn, Slapi_Mods *smods, int opflags);
int is_suffix_dn (Slapi_PBlock *pb, const Slapi_DN *dn, Slapi_DN **parenddn);
@@ -69,7 +69,7 @@ int is_suffix_dn (Slapi_PBlock *pb, const Slapi_DN *dn, Slapi_DN **parenddn); */ int is_glue_entry(const Slapi_Entry* entry); int create_glue_entry ( Slapi_PBlock *pb, char *sessionid, Slapi_DN *dn, const char *uniqueid, CSN *opcsn ); -int entry_to_glue(char *sessionid, const Slapi_Entry* entry, const char *reason, CSN *opcsn, void *txn); +int entry_to_glue(char *sessionid, const Slapi_Entry* entry, const char *reason, CSN *opcsn); int glue_to_entry (Slapi_PBlock *pb, Slapi_Entry *entry ); PRBool get_glue_csn(const Slapi_Entry *entry, const CSN **gluecsn);
diff --git a/ldap/servers/plugins/replication/urp_glue.c b/ldap/servers/plugins/replication/urp_glue.c index 499cb97..e51712c 100644 --- a/ldap/servers/plugins/replication/urp_glue.c +++ b/ldap/servers/plugins/replication/urp_glue.c @@ -92,7 +92,7 @@ get_glue_csn(const Slapi_Entry *entry, const CSN **gluecsn) * Submit a Modify operation to turn the Entry into Glue. */ int -entry_to_glue(char *sessionid, const Slapi_Entry* entry, const char *reason, CSN *opcsn, void *txn) +entry_to_glue(char *sessionid, const Slapi_Entry* entry, const char *reason, CSN *opcsn) { int op_result = 0; const char *dn; @@ -135,7 +135,7 @@ entry_to_glue(char *sessionid, const Slapi_Entry* entry, const char *reason, CSN
if (slapi_mods_get_num_mods(&smods) > 0) { - op_result = urp_fixup_modify_entry (NULL, sdn, opcsn, &smods, 0, txn); + op_result = urp_fixup_modify_entry (NULL, sdn, opcsn, &smods, 0); if (op_result == LDAP_SUCCESS) { slapi_log_error (slapi_log_urp, repl_plugin_name, @@ -158,7 +158,7 @@ static const char *glue_entry = "%s: %s\n"; /* Add why it's been created */
static int -do_create_glue_entry(const Slapi_RDN *rdn, const Slapi_DN *superiordn, const char *uniqueid, const char *reason, CSN *opcsn, void *txn) +do_create_glue_entry(const Slapi_RDN *rdn, const Slapi_DN *superiordn, const char *uniqueid, const char *reason, CSN *opcsn) { int op_result= LDAP_OPERATIONS_ERROR; int rdnval_index = 0; @@ -202,7 +202,7 @@ do_create_glue_entry(const Slapi_RDN *rdn, const Slapi_DN *superiordn, const cha if ( e!=NULL ) { slapi_entry_set_uniqueid (e, slapi_ch_strdup(uniqueid)); - op_result = urp_fixup_add_entry (e, NULL, NULL, opcsn, 0, txn); + op_result = urp_fixup_add_entry (e, NULL, NULL, opcsn, 0); } slapi_ch_free_string(&estr); slapi_sdn_free(&sdn); @@ -214,14 +214,12 @@ create_glue_entry ( Slapi_PBlock *pb, char *sessionid, Slapi_DN *dn, const char { int op_result; const char *dnstr; - void *txn = NULL;
if ( slapi_sdn_get_dn (dn) ) dnstr = slapi_sdn_get_dn (dn); else dnstr = "";
- slapi_pblock_get(pb, SLAPI_TXN, &txn); if ( NULL == uniqueid ) { op_result = LDAP_OPERATIONS_ERROR; @@ -241,7 +239,7 @@ create_glue_entry ( Slapi_PBlock *pb, char *sessionid, Slapi_DN *dn, const char
while(!done) { - op_result= do_create_glue_entry(rdn, superiordn, uniqueid, "missingEntry", opcsn, txn); + op_result= do_create_glue_entry(rdn, superiordn, uniqueid, "missingEntry", opcsn); switch(op_result) { case LDAP_SUCCESS: diff --git a/ldap/servers/plugins/replication/urp_tombstone.c b/ldap/servers/plugins/replication/urp_tombstone.c index 7c36421..6dd9a2a 100644 --- a/ldap/servers/plugins/replication/urp_tombstone.c +++ b/ldap/servers/plugins/replication/urp_tombstone.c @@ -94,10 +94,6 @@ tombstone_to_glue_resolve_parent ( { int op_result; Slapi_PBlock *newpb= slapi_pblock_new(); - void *txn = NULL; - - slapi_pblock_get(pb, SLAPI_TXN, &txn); - slapi_pblock_set(newpb, SLAPI_TXN, txn); slapi_search_internal_set_pb( newpb, slapi_sdn_get_dn(parentdn), /* JCM - This DN just identifies the backend to be searched. */ @@ -160,7 +156,6 @@ tombstone_to_glue ( Slapi_Entry *addingentry; const char *addingdn; int op_result; - void *txn = NULL;
/* JCMREPL * Nothing logged to the 5.0 Change Log @@ -194,8 +189,7 @@ tombstone_to_glue ( slapi_entry_add_string(addingentry, ATTR_NSDS5_REPLCONFLICT, reason); } tombstoneuniqueid= slapi_entry_get_uniqueid(tombstoneentry); - slapi_pblock_get (pb, SLAPI_TXN, &txn); - op_result = urp_fixup_add_entry (addingentry, tombstoneuniqueid, parentuniqueid, opcsn, OP_FLAG_RESURECT_ENTRY, txn); + op_result = urp_fixup_add_entry (addingentry, tombstoneuniqueid, parentuniqueid, opcsn, OP_FLAG_RESURECT_ENTRY); if (op_result == LDAP_SUCCESS) { slapi_log_error (slapi_log_urp, repl_plugin_name, @@ -219,7 +213,6 @@ entry_to_tombstone ( Slapi_PBlock *pb, Slapi_Entry *entry ) CSN *opcsn; const char *uniqueid; int op_result = LDAP_SUCCESS; - void *txn = NULL;
slapi_pblock_get ( pb, SLAPI_OPERATION, &op ); opcsn = operation_get_csn ( op ); @@ -234,10 +227,9 @@ entry_to_tombstone ( Slapi_PBlock *pb, Slapi_Entry *entry ) */ slapi_mods_add ( &smods, LDAP_MOD_DELETE, ATTR_NSDS5_REPLCONFLICT, 0, NULL );
- slapi_pblock_get (pb, SLAPI_TXN, &txn); op_result = urp_fixup_modify_entry (uniqueid, slapi_entry_get_sdn_const (entry), - opcsn, &smods, 0, txn); + opcsn, &smods, 0); slapi_mods_done ( &smods );
/* @@ -250,7 +242,7 @@ entry_to_tombstone ( Slapi_PBlock *pb, Slapi_Entry *entry ) * through the urp operations and trigger the recursive * fixup if applicable. */ - op_result = urp_fixup_delete_entry (uniqueid, slapi_entry_get_dn_const (entry), opcsn, 0, txn); + op_result = urp_fixup_delete_entry (uniqueid, slapi_entry_get_dn_const (entry), opcsn, 0); }
return op_result; diff --git a/ldap/servers/plugins/retrocl/retrocl_po.c b/ldap/servers/plugins/retrocl/retrocl_po.c index 729ffbb..29ce79f 100644 --- a/ldap/servers/plugins/retrocl/retrocl_po.c +++ b/ldap/servers/plugins/retrocl/retrocl_po.c @@ -178,15 +178,12 @@ write_replog_db( changeNumber changenum; int i; int extensibleObject = 0; - void *txn = NULL;
if (!dn) { slapi_log_error( SLAPI_LOG_PLUGIN, RETROCL_PLUGIN_NAME, "write_replog_db: NULL dn\n"); return; }
- slapi_pblock_get(pb, SLAPI_TXN, &txn); - PR_Lock(retrocl_internal_lock); changenum = retrocl_assign_changenumber();
@@ -364,7 +361,6 @@ write_replog_db( slapi_add_entry_internal_set_pb( newPb, e, NULL /* controls */, g_plg_identity[PLUGIN_RETROCL], 0 /* actions */ ); - slapi_pblock_set (newPb, SLAPI_TXN, txn); slapi_add_internal_pb (newPb); slapi_pblock_get( newPb, SLAPI_PLUGIN_INTOP_RESULT, &rc ); slapi_pblock_destroy(newPb); diff --git a/ldap/servers/plugins/uiduniq/plugin-utils.h b/ldap/servers/plugins/uiduniq/plugin-utils.h index 9c5eeb1..5cdd95b 100644 --- a/ldap/servers/plugins/uiduniq/plugin-utils.h +++ b/ldap/servers/plugins/uiduniq/plugin-utils.h @@ -87,10 +87,10 @@
int op_error(int internal_error); Slapi_PBlock *readPblockAndEntry( const char *baseDN, const char *filter, - char *attrs[], void *txn, void *pluginid ); + char *attrs[] ); int entryHasObjectClass(Slapi_PBlock *pb, Slapi_Entry *e, const char *objectClass); -Slapi_PBlock *dnHasObjectClass( const char *baseDN, const char *objectClass, void *txn, void *pluginid ); -Slapi_PBlock *dnHasAttribute( const char *baseDN, const char *attrName, void *txn, void *pluginid ); +Slapi_PBlock *dnHasObjectClass( const char *baseDN, const char *objectClass ); +Slapi_PBlock *dnHasAttribute( const char *baseDN, const char *attrName );
#endif /* _PLUGIN_UTILS_H_ */ diff --git a/ldap/servers/plugins/uiduniq/uid.c b/ldap/servers/plugins/uiduniq/uid.c index e1b855c..8bd5e17 100644 --- a/ldap/servers/plugins/uiduniq/uid.c +++ b/ldap/servers/plugins/uiduniq/uid.c @@ -70,7 +70,7 @@ int ldap_quote_filter_value(
static int search_one_berval(const char *baseDN, const char *attrName, - const struct berval *value, const char *requiredObjectClass, const char *target, void *txn); + const struct berval *value, const char *requiredObjectClass, const char *target);
/* * ISSUES: @@ -226,7 +226,7 @@ create_filter(const char *attribute, const struct berval *value, const char *req static int search(const char *baseDN, const char *attrName, Slapi_Attr *attr, struct berval **values, const char *requiredObjectClass, - const char *target, void *txn) + const char *target) { int result;
@@ -260,7 +260,7 @@ search(const char *baseDN, const char *attrName, Slapi_Attr *attr, { result = search_one_berval(baseDN, attrName, slapi_value_get_berval(v), - requiredObjectClass, target, txn); + requiredObjectClass, target); } } else @@ -268,7 +268,7 @@ search(const char *baseDN, const char *attrName, Slapi_Attr *attr, for (;*values != NULL && LDAP_SUCCESS == result; values++) { result = search_one_berval(baseDN, attrName, *values, requiredObjectClass, - target, txn); + target); } }
@@ -284,7 +284,7 @@ search(const char *baseDN, const char *attrName, Slapi_Attr *attr, static int search_one_berval(const char *baseDN, const char *attrName, const struct berval *value, const char *requiredObjectClass, - const char *target, void *txn) + const char *target) { int result; char *filter; @@ -319,7 +319,6 @@ search_one_berval(const char *baseDN, const char *attrName,
slapi_search_internal_set_pb(spb, baseDN, LDAP_SCOPE_SUBTREE, filter, attrs, 0 /* attrs only */, NULL, NULL, plugin_identity, 0 /* actions */); - slapi_pblock_set(spb, SLAPI_TXN, txn); slapi_search_internal_pb(spb);
err = slapi_pblock_get(spb, SLAPI_PLUGIN_INTOP_RESULT, &sres); @@ -395,7 +394,7 @@ search_one_berval(const char *baseDN, const char *attrName, static int searchAllSubtrees(int argc, char *argv[], const char *attrName, Slapi_Attr *attr, struct berval **values, const char *requiredObjectClass, - const char *dn, void *txn) + const char *dn) { int result = LDAP_SUCCESS;
@@ -410,7 +409,7 @@ searchAllSubtrees(int argc, char *argv[], const char *attrName, * worry about that here. */ if (slapi_dn_issuffix(dn, *argv)) { - result = search(*argv, attrName, attr, values, requiredObjectClass, dn, txn); + result = search(*argv, attrName, attr, values, requiredObjectClass, dn); if (result) break; } } @@ -500,14 +499,14 @@ getArguments(Slapi_PBlock *pb, char **attrName, char **markerObjectClass, static int findSubtreeAndSearch(char *parentDN, const char *attrName, Slapi_Attr *attr, struct berval **values, const char *requiredObjectClass, const char *target, - const char *markerObjectClass, void *txn) + const char *markerObjectClass) { int result = LDAP_SUCCESS; Slapi_PBlock *spb = NULL;
while (NULL != (parentDN = slapi_dn_parent(parentDN))) { - if ((spb = dnHasObjectClass(parentDN, markerObjectClass, txn, plugin_identity))) + if ((spb = dnHasObjectClass(parentDN, markerObjectClass))) { freePblock(spb); /* @@ -515,7 +514,7 @@ findSubtreeAndSearch(char *parentDN, const char *attrName, Slapi_Attr *attr, * to have the attribute already. */ result = search(parentDN, attrName, attr, values, requiredObjectClass, - target, txn); + target); break; } } @@ -555,7 +554,6 @@ preop_add(Slapi_PBlock *pb) Slapi_Attr *attr; int argc; char **argv = NULL; - void *txn = NULL;
/* * If this is a replication update, just be a noop. @@ -567,7 +565,6 @@ preop_add(Slapi_PBlock *pb) break; }
- slapi_pblock_get(pb, SLAPI_TXN, &txn); /* * Get the arguments */ @@ -634,12 +631,12 @@ preop_add(Slapi_PBlock *pb) /* Subtree defined by location of marker object class */ result = findSubtreeAndSearch((char *)dn, attrName, attr, NULL, requiredObjectClass, dn, - markerObjectClass, txn); + markerObjectClass); } else { /* Subtrees listed on invocation line */ result = searchAllSubtrees(argc, argv, attrName, attr, NULL, - requiredObjectClass, dn, txn); + requiredObjectClass, dn); } END
@@ -711,7 +708,6 @@ preop_modify(Slapi_PBlock *pb) int isupdatedn; int argc; char **argv = NULL; - void *txn = NULL;
/* * If this is a replication update, just be a noop. @@ -723,7 +719,6 @@ preop_modify(Slapi_PBlock *pb) break; }
- slapi_pblock_get(pb, SLAPI_TXN, &txn); /* * Get the arguments */ @@ -785,7 +780,7 @@ preop_modify(Slapi_PBlock *pb) * Check if it has the required object class */ if (requiredObjectClass && - !(spb = dnHasObjectClass(dn, requiredObjectClass, txn, plugin_identity))) { + !(spb = dnHasObjectClass(dn, requiredObjectClass))) { break; }
@@ -805,12 +800,12 @@ preop_modify(Slapi_PBlock *pb) /* Subtree defined by location of marker object class */ result = findSubtreeAndSearch((char *)dn, attrName, NULL, mod->mod_bvalues, requiredObjectClass, - dn, markerObjectClass, txn); + dn, markerObjectClass); } else { /* Subtrees listed on invocation line */ result = searchAllSubtrees(argc, argv, attrName, NULL, - mod->mod_bvalues, requiredObjectClass, dn, txn); + mod->mod_bvalues, requiredObjectClass, dn); } } END @@ -871,7 +866,6 @@ preop_modrdn(Slapi_PBlock *pb) Slapi_Attr *attr; int argc; char **argv = NULL; - void *txn = NULL;
/* * If this is a replication update, just be a noop. @@ -883,7 +877,6 @@ preop_modrdn(Slapi_PBlock *pb) break; }
- slapi_pblock_get(pb, SLAPI_TXN, &txn); /* * Get the arguments */ @@ -942,7 +935,7 @@ preop_modrdn(Slapi_PBlock *pb)
/* Get the entry that is being renamed so we can make a dummy copy * of what it will look like after the rename. */ - err = slapi_search_internal_get_entry_ext(sdn, NULL, &e, plugin_identity, txn); + err = slapi_search_internal_get_entry(sdn, NULL, &e, plugin_identity); if (err != LDAP_SUCCESS) { result = uid_op_error(35); /* We want to return a no such object error if the target doesn't exist. */ @@ -978,12 +971,12 @@ preop_modrdn(Slapi_PBlock *pb) /* Subtree defined by location of marker object class */ result = findSubtreeAndSearch(slapi_entry_get_dn(e), attrName, attr, NULL, requiredObjectClass, dn, - markerObjectClass, txn); + markerObjectClass); } else { /* Subtrees listed on invocation line */ result = searchAllSubtrees(argc, argv, attrName, attr, NULL, - requiredObjectClass, dn, txn); + requiredObjectClass, dn); } END /* Clean-up */ diff --git a/ldap/servers/plugins/uiduniq/utils.c b/ldap/servers/plugins/uiduniq/utils.c index 567218a..4966089 100644 --- a/ldap/servers/plugins/uiduniq/utils.c +++ b/ldap/servers/plugins/uiduniq/utils.c @@ -82,22 +82,19 @@ op_error(int internal_error) { */ Slapi_PBlock * readPblockAndEntry( const char *baseDN, const char *filter, - char *attrs[], void *txn, void *pluginid ) { + char *attrs[] ) { Slapi_PBlock *spb = NULL;
BEGIN int sres;
- spb = slapi_pblock_new(); - if (!spb) { + /* Perform the search - the new pblock needs to be freed */ + spb = slapi_search_internal((char *)baseDN, LDAP_SCOPE_BASE, + (char *)filter, NULL, attrs, 0); + if ( !spb ) { op_error(20); break; } - slapi_search_internal_set_pb (spb, baseDN, LDAP_SCOPE_BASE, filter, - attrs, 0, NULL, - NULL, pluginid, 0); - slapi_pblock_set(spb, SLAPI_TXN, txn); - slapi_search_internal_pb (spb);
if ( slapi_pblock_get( spb, SLAPI_PLUGIN_INTOP_RESULT, &sres ) ) { op_error(21); @@ -153,7 +150,7 @@ entryHasObjectClass(Slapi_PBlock *pb, Slapi_Entry *e, * A pblock containing the entry, or NULL */ Slapi_PBlock * -dnHasObjectClass( const char *baseDN, const char *objectClass, void *txn, void *pluginid ) { +dnHasObjectClass( const char *baseDN, const char *objectClass ) { char *filter = NULL; Slapi_PBlock *spb = NULL;
@@ -165,7 +162,7 @@ dnHasObjectClass( const char *baseDN, const char *objectClass, void *txn, void * attrs[0] = "objectclass"; attrs[1] = NULL; filter = PR_smprintf("objectclass=%s", objectClass ); - if ( !(spb = readPblockAndEntry( baseDN, filter, attrs, txn, pluginid ) ) ) { + if ( !(spb = readPblockAndEntry( baseDN, filter, attrs) ) ) { break; }
@@ -199,7 +196,7 @@ dnHasObjectClass( const char *baseDN, const char *objectClass, void *txn, void * * The entry, or NULL */ Slapi_PBlock * -dnHasAttribute( const char *baseDN, const char *attrName, void *txn, void *pluginid ) { +dnHasAttribute( const char *baseDN, const char *attrName ) { Slapi_PBlock *spb = NULL; char *filter = NULL;
@@ -212,16 +209,12 @@ dnHasAttribute( const char *baseDN, const char *attrName, void *txn, void *plugi attrs[0] = (char *)attrName; attrs[1] = NULL; filter = PR_smprintf( "%s=*", attrName ); - spb = slapi_pblock_new(); - if (!spb) { + spb = slapi_search_internal((char *)baseDN, LDAP_SCOPE_BASE, + filter, NULL, attrs, 0); + if ( !spb ) { op_error(20); break; } - slapi_search_internal_set_pb (spb, baseDN, LDAP_SCOPE_BASE, filter, - attrs, 0, NULL, - NULL, pluginid, 0); - slapi_pblock_set(spb, SLAPI_TXN, txn); - slapi_search_internal_pb (spb);
if ( slapi_pblock_get( spb, SLAPI_PLUGIN_INTOP_RESULT, &sres ) ) { op_error(21); diff --git a/ldap/servers/slapd/modify.c b/ldap/servers/slapd/modify.c index c346a6a..7ec9ff9 100644 --- a/ldap/servers/slapd/modify.c +++ b/ldap/servers/slapd/modify.c @@ -1046,7 +1046,6 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old char *proxydn = NULL; char *proxystr = NULL; char *errtext = NULL; - void *txn = NULL;
slapi_pblock_get (pb, SLAPI_IS_REPLICATED_OPERATION, &repl_op); if (repl_op) { @@ -1061,7 +1060,6 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old slapi_pblock_get (pb, SLAPI_OPERATION, &operation); slapi_pblock_get (pb, SLAPI_PWPOLICY, &pwresponse_req); internal_op= operation_is_flag_set(operation, OP_FLAG_INTERNAL); - slapi_pblock_get (pb, SLAPI_TXN, &txn);
slapi_sdn_init_dn_byref (&sdn, dn); pwpolicy = new_passwdPolicy(pb, (char *)slapi_sdn_get_ndn(&sdn)); @@ -1091,7 +1089,7 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old mods[1] = NULL;
/* We need to actually fetch the target here to use for ACI checking. */ - slapi_search_internal_get_entry_ext(&sdn, NULL, &e, (void *)plugin_get_default_component_id(), txn); + slapi_search_internal_get_entry(&sdn, NULL, &e, (void *)plugin_get_default_component_id());
/* Create a bogus entry with just the target dn if we were unable to * find the actual entry. This will only be used for checking the ACIs. */ diff --git a/ldap/servers/slapd/passwd_extop.c b/ldap/servers/slapd/passwd_extop.c index c05dd81..c77d3b7 100644 --- a/ldap/servers/slapd/passwd_extop.c +++ b/ldap/servers/slapd/passwd_extop.c @@ -153,7 +153,6 @@ passwd_apply_mods(Slapi_PBlock *pb_orig, const Slapi_DN *sdn, Slapi_Mods *mods, LDAPControl **req_controls_copy = NULL; LDAPControl **pb_resp_controls = NULL; int ret=0; - void *txn = NULL;
LDAPDebug( LDAP_DEBUG_TRACE, "=> passwd_apply_mods\n", 0, 0, 0 );
@@ -180,9 +179,6 @@ passwd_apply_mods(Slapi_PBlock *pb_orig, const Slapi_DN *sdn, Slapi_Mods *mods, * that it was done by the root DN. */ pb.pb_conn = pb_orig->pb_conn;
- slapi_pblock_get(pb_orig, SLAPI_TXN, &txn); - slapi_pblock_set(&pb, SLAPI_TXN, txn); - ret =slapi_modify_internal_pb (&pb);
/* We now clean up the connection that we copied into the diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h index 01ca512..d7057a1 100644 --- a/ldap/servers/slapd/proto-slap.h +++ b/ldap/servers/slapd/proto-slap.h @@ -868,7 +868,6 @@ void pw_add_allowchange_aci(Slapi_Entry *e, int pw_prohibit_change); */ int update_pw_retry ( Slapi_PBlock *pb ); void pw_apply_mods(const Slapi_DN *sdn, Slapi_Mods *mods); -void pw_apply_mods_ext(const Slapi_DN *sdn, Slapi_Mods *mods, void *txn); void pw_set_componentID(struct slapi_componentid * cid); struct slapi_componentid * pw_get_componentID();
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c index 2a7b29b..3bc7334 100644 --- a/ldap/servers/slapd/pw.c +++ b/ldap/servers/slapd/pw.c @@ -593,9 +593,7 @@ update_pw_info ( Slapi_PBlock *pb , char *old_pw) { passwdPolicy *pwpolicy = NULL; int internal_op = 0; Slapi_Operation *operation = NULL; - void *txn = NULL;
- slapi_pblock_get(pb, SLAPI_TXN, &txn); slapi_pblock_get(pb, SLAPI_OPERATION, &operation); internal_op = slapi_operation_is_flag_set(operation, SLAPI_OP_FLAG_INTERNAL);
@@ -668,7 +666,7 @@ update_pw_info ( Slapi_PBlock *pb , char *old_pw) { } else if (prev_exp_date == SLAPD_END_TIME) { /* Special entries' passwords never expire */ slapi_ch_free((void**)&prev_exp_date_str); - pw_apply_mods_ext(sdn, &smods, txn); + pw_apply_mods(sdn, &smods); slapi_mods_done(&smods); delete_passwdPolicy(&pwpolicy); return 0; @@ -685,7 +683,7 @@ update_pw_info ( Slapi_PBlock *pb , char *old_pw) { */ pw_exp_date = NOT_FIRST_TIME; } else { - pw_apply_mods_ext(sdn, &smods, txn); + pw_apply_mods(sdn, &smods); slapi_mods_done(&smods); delete_passwdPolicy(&pwpolicy); return 0; @@ -699,7 +697,7 @@ update_pw_info ( Slapi_PBlock *pb , char *old_pw) { slapi_mods_add_string(&smods, LDAP_MOD_REPLACE, "passwordExpWarned", "0");
- pw_apply_mods_ext(sdn, &smods, txn); + pw_apply_mods(sdn, &smods); slapi_mods_done(&smods); if (pb->pb_conn) { /* no conn for internal op */ /* reset c_needpw to 0 */ @@ -1082,7 +1080,6 @@ update_pw_history( Slapi_PBlock *pb, const Slapi_DN *sdn, char *old_pw ) char *str; passwdPolicy *pwpolicy = NULL; const char *dn = slapi_sdn_get_dn(sdn); - void *txn = NULL;
pwpolicy = new_passwdPolicy(pb, dn);
@@ -1141,10 +1138,8 @@ update_pw_history( Slapi_PBlock *pb, const Slapi_DN *sdn, char *old_pw ) list_of_mods[1] = NULL;
pblock_init(&mod_pb); - slapi_pblock_get(pb, SLAPI_TXN, &txn); slapi_modify_internal_set_pb_ext(&mod_pb, sdn, list_of_mods, NULL, NULL, pw_get_componentID(), 0); - slapi_pblock_set(&mod_pb, SLAPI_TXN, txn); slapi_modify_internal_pb(&mod_pb); slapi_pblock_get(&mod_pb, SLAPI_PLUGIN_INTOP_RESULT, &res); if (res != LDAP_SUCCESS){ diff --git a/ldap/servers/slapd/pw_mgmt.c b/ldap/servers/slapd/pw_mgmt.c index 28b0491..8d99879 100644 --- a/ldap/servers/slapd/pw_mgmt.c +++ b/ldap/servers/slapd/pw_mgmt.c @@ -67,9 +67,7 @@ need_new_pw( Slapi_PBlock *pb, long *t, Slapi_Entry *e, int pwresponse_req ) passwdPolicy *pwpolicy = NULL; int pwdGraceUserTime = 0; char graceUserTime[8]; - void *txn = NULL;
- slapi_pblock_get(pb, SLAPI_TXN, &txn); slapi_mods_init (&smods, 0); sdn = slapi_entry_get_sdn_const( e ); dn = slapi_entry_get_ndn( e ); @@ -104,9 +102,9 @@ need_new_pw( Slapi_PBlock *pb, long *t, Slapi_Entry *e, int pwresponse_req ) slapi_ch_free((void **)×tring); slapi_mods_add_string(&smods, LDAP_MOD_REPLACE, "passwordExpWarned", "0"); - pw_apply_mods_ext(sdn, &smods, txn); + pw_apply_mods(sdn, &smods); } else if (pwpolicy->pw_lockout == 1) { - pw_apply_mods_ext(sdn, &smods, txn); + pw_apply_mods(sdn, &smods); } slapi_mods_done(&smods); delete_passwdPolicy(&pwpolicy); @@ -152,7 +150,7 @@ skip: } slapi_add_pwd_control ( pb, LDAP_CONTROL_PWEXPIRED, 0); } - pw_apply_mods_ext(sdn, &smods, txn); + pw_apply_mods(sdn, &smods); slapi_mods_done(&smods); delete_passwdPolicy(&pwpolicy); return ( 0 ); @@ -175,7 +173,7 @@ skip: sprintf ( graceUserTime, "%d", pwdGraceUserTime ); slapi_mods_add_string(&smods, LDAP_MOD_REPLACE, "passwordGraceUserTime", graceUserTime); - pw_apply_mods_ext(sdn, &smods, txn); + pw_apply_mods(sdn, &smods); slapi_mods_done(&smods); if (pwresponse_req) { /* check for "changeafterreset" condition */ @@ -218,7 +216,7 @@ skip: pb->pb_op->o_opid, SLAPD_DISCONNECT_UNBIND, 0); } /* Apply current modifications */ - pw_apply_mods_ext(sdn, &smods, txn); + pw_apply_mods(sdn, &smods); slapi_mods_done(&smods); delete_passwdPolicy(&pwpolicy); return (-1); @@ -265,7 +263,7 @@ skip: *t = (long)diff_t; /* jcm: had to cast double to long */ } - pw_apply_mods_ext(sdn, &smods, txn); + pw_apply_mods(sdn, &smods); slapi_mods_done(&smods); if (pwresponse_req) { /* check for "changeafterreset" condition */ @@ -285,7 +283,7 @@ skip: return (2); }
- pw_apply_mods_ext(sdn, &smods, txn); + pw_apply_mods(sdn, &smods); slapi_mods_done(&smods); /* Leftover from "changeafterreset" condition */ if (pb->pb_conn->c_needpw == 1) { diff --git a/ldap/servers/slapd/pw_retry.c b/ldap/servers/slapd/pw_retry.c index 48849fb..5244622 100644 --- a/ldap/servers/slapd/pw_retry.c +++ b/ldap/servers/slapd/pw_retry.c @@ -130,9 +130,7 @@ void set_retry_cnt_and_time ( Slapi_PBlock *pb, int count, time_t cur_time ) { time_t reset_time; char *timestr; passwdPolicy *pwpolicy = NULL; - void *txn = NULL;
- slapi_pblock_get( pb, SLAPI_TXN, &txn ); slapi_pblock_get( pb, SLAPI_TARGET_SDN, &sdn ); dn = slapi_sdn_get_dn(sdn); pwpolicy = new_passwdPolicy(pb, dn); @@ -148,7 +146,7 @@ void set_retry_cnt_and_time ( Slapi_PBlock *pb, int count, time_t cur_time ) {
set_retry_cnt_mods(pb, &smods, count); - pw_apply_mods_ext(sdn, &smods, txn); + pw_apply_mods(sdn, &smods); slapi_mods_done(&smods); delete_passwdPolicy(&pwpolicy); } @@ -195,13 +193,11 @@ void set_retry_cnt ( Slapi_PBlock *pb, int count) { Slapi_DN *sdn = NULL; Slapi_Mods smods; - void *txn = NULL; - - slapi_pblock_get( pb, SLAPI_TXN, &txn ); + slapi_pblock_get( pb, SLAPI_TARGET_SDN, &sdn ); slapi_mods_init(&smods, 0); set_retry_cnt_mods(pb, &smods, count); - pw_apply_mods_ext(sdn, &smods, txn); + pw_apply_mods(sdn, &smods); slapi_mods_done(&smods); }
@@ -212,7 +208,6 @@ Slapi_Entry *get_entry ( Slapi_PBlock *pb, const char *dn) Slapi_Entry *retentry = NULL; Slapi_DN *target_sdn = NULL; Slapi_DN sdn; - void *txn = NULL;
if (NULL == pb) { LDAPDebug(LDAP_DEBUG_ANY, "get_entry - no pblock specified.\n", @@ -221,7 +216,6 @@ Slapi_Entry *get_entry ( Slapi_PBlock *pb, const char *dn) }
slapi_pblock_get( pb, SLAPI_TARGET_SDN, &target_sdn ); - slapi_pblock_get( pb, SLAPI_TXN, &txn );
if (dn == NULL) { dn = slapi_sdn_get_dn(target_sdn); @@ -238,9 +232,9 @@ Slapi_Entry *get_entry ( Slapi_PBlock *pb, const char *dn) target_sdn = &sdn; }
- search_result = slapi_search_internal_get_entry_ext(target_sdn, NULL, - &retentry, - pw_get_componentID(), txn); + search_result = slapi_search_internal_get_entry(target_sdn, NULL, + &retentry, + pw_get_componentID()); if (search_result != LDAP_SUCCESS) { LDAPDebug (LDAP_DEBUG_TRACE, "WARNING: 'get_entry' can't find entry '%s', err %d\n", dn, search_result, 0); } @@ -250,7 +244,7 @@ bail: }
void -pw_apply_mods_ext(const Slapi_DN *sdn, Slapi_Mods *mods, void *txn) +pw_apply_mods(const Slapi_DN *sdn, Slapi_Mods *mods) { Slapi_PBlock pb; int res; @@ -266,7 +260,6 @@ pw_apply_mods_ext(const Slapi_DN *sdn, Slapi_Mods *mods, void *txn) NULL, /* UniqueID */ pw_get_componentID(), /* PluginID */ OP_FLAG_SKIP_MODIFIED_ATTRS); /* Flags */ - slapi_pblock_set(&pb, SLAPI_TXN, txn); slapi_modify_internal_pb (&pb); slapi_pblock_get(&pb, SLAPI_PLUGIN_INTOP_RESULT, &res); @@ -282,11 +275,6 @@ pw_apply_mods_ext(const Slapi_DN *sdn, Slapi_Mods *mods, void *txn) return; }
-void -pw_apply_mods(const Slapi_DN *sdn, Slapi_Mods *mods) -{ - pw_apply_mods_ext(sdn, mods, NULL); -} /* Handle the component ID for the password policy */
static struct slapi_componentid * pw_componentid = NULL;
commit 9c0c0aa09d573f67cab4ef2cd0ac10edc9bed694 Author: Rich Megginson rmeggins@redhat.com Date: Thu Feb 16 12:51:23 2012 -0700
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).
diff --git a/ldap/servers/plugins/automember/automember.c b/ldap/servers/plugins/automember/automember.c index 06f27bd..92d5ae6 100644 --- a/ldap/servers/plugins/automember/automember.c +++ b/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); diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c index efb2de4..a422055 100644 --- a/ldap/servers/plugins/dna/dna.c +++ b/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); } }
diff --git a/ldap/servers/plugins/linkedattrs/fixup_task.c b/ldap/servers/plugins/linkedattrs/fixup_task.c index 4b82002..c1af2f2 100644 --- a/ldap/servers/plugins/linkedattrs/fixup_task.c +++ b/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]; diff --git a/ldap/servers/plugins/linkedattrs/linked_attrs.c b/ldap/servers/plugins/linkedattrs/linked_attrs.c index 63cae9f..ccc067c 100644 --- a/ldap/servers/plugins/linkedattrs/linked_attrs.c +++ b/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); diff --git a/ldap/servers/plugins/linkedattrs/linked_attrs.h b/ldap/servers/plugins/linkedattrs/linked_attrs.h index 89318e1..137e317 100644 --- a/ldap/servers/plugins/linkedattrs/linked_attrs.h +++ b/ldap/servers/plugins/linkedattrs/linked_attrs.h @@ -100,7 +100,6 @@ struct configIndex { typedef struct _task_data { char *linkdn; - Slapi_PBlock *pb; } task_data;
diff --git a/ldap/servers/plugins/memberof/memberof.c b/ldap/servers/plugins/memberof/memberof.c index 6699e22..5100b1a 100644 --- a/ldap/servers/plugins/memberof/memberof.c +++ b/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 *)); diff --git a/ldap/servers/plugins/mep/mep.c b/ldap/servers/plugins/mep/mep.c index 6161c16..303d9b3 100644 --- a/ldap/servers/plugins/mep/mep.c +++ b/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(); diff --git a/ldap/servers/plugins/referint/referint.c b/ldap/servers/plugins/referint/referint.c index ee7c781..4606de6 100644 --- a/ldap/servers/plugins/referint/referint.c +++ b/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" diff --git a/ldap/servers/slapd/add.c b/ldap/servers/slapd/add.c index 434901e..206dfc4 100644 --- a/ldap/servers/slapd/add.c +++ b/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); } diff --git a/ldap/servers/slapd/modify.c b/ldap/servers/slapd/modify.c index 869eb27..c346a6a 100644 --- a/ldap/servers/slapd/modify.c +++ b/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); diff --git a/ldap/servers/slapd/modrdn.c b/ldap/servers/slapd/modrdn.c index 7cd88ce..2c8aae8 100644 --- a/ldap/servers/slapd/modrdn.c +++ b/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); diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c index f3df0f6..b607f28 100644 --- a/ldap/servers/slapd/pblock.c +++ b/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); } }
@@ -155,14 +118,6 @@ pblock_done( Slapi_PBlock *pb ) }
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 ) { if(pb!=NULL) diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h index 6b868f5..01ca512 100644 --- a/ldap/servers/slapd/proto-slap.h +++ b/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); diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h index cd9fcab..20c7a5c 100644 --- a/ldap/servers/slapd/slapi-plugin.h +++ b/ldap/servers/slapd/slapi-plugin.h @@ -607,19 +607,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. * * \param pb The parameter block to initialize.
389-commits@lists.fedoraproject.org