There are 3 patches. 0001 fixes a problem with betxn and modrdn to make
the ENTRY_POST_OP available to betxnpostop plugins. 0002 allows us to
pass the plugin config entry to plugin_init functions (yay! finally!).
0003 is the actual change to memberof.
From 0cc8c050795e575617fcb1f88ce9890a2358 Mon Sep 17 00:00:00 2001
From: Rich Megginson rmegg...@redhat.com
Date: Thu, 6 Oct 2011 08:12:21 -0600
Subject: [PATCH 1/3] set the ENTRY_POST_OP for modrdn betxnpostoperation plugins
The ENTRY_POST_OP needs to be set before calling the betxnpostoperation plugins
for the modrdn operation (e.g. for memberof).
---
ldap/servers/slapd/back-ldbm/ldbm_modrdn.c |4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
index 4aa771f..bcbe9c7 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
@@ -916,6 +916,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
modify_switch_entries( newparent_modify_context,be);
}
+slapi_pblock_set( pb, SLAPI_ENTRY_POST_OP, postentry );
/* call the transaction post modrdn plugins just before the commit */
if ((retval = plugin_call_plugins(pb, SLAPI_PLUGIN_BE_TXN_POST_MODRDN_FN))) {
LDAPDebug1Arg( LDAP_DEBUG_ANY, SLAPI_PLUGIN_BE_TXN_POST_MODRDN_FN plugin
@@ -994,6 +995,8 @@ error_return:
{
slapi_entry_free( postentry );
postentry= NULL;
+/* make sure caller doesn't attempt to free this */
+slapi_pblock_set( pb, SLAPI_ENTRY_POST_OP, postentry );
}
if (e entryrdn_get_switch())
{
@@ -1117,7 +1120,6 @@ common_return:
{
slapi_pblock_set(pb, SLAPI_URP_NAMING_COLLISION_DN, slapi_ch_strdup (dn));
}
-slapi_pblock_set( pb, SLAPI_ENTRY_POST_OP, postentry );
if (pb-pb_conn)
{
slapi_log_error (SLAPI_LOG_TRACE, ldbm_back_modrdn, leave conn=% NSPRIu64 op=%d\n, pb-pb_conn-c_connid, operation-o_opid);
--
1.7.1
From 4a5b40295a2b9f7fce161278c9ccd76e5eff8b55 Mon Sep 17 00:00:00 2001
From: Rich Megginson rmegg...@redhat.com
Date: Wed, 5 Oct 2011 16:53:30 -0600
Subject: [PATCH 2/3] pass the plugin config entry to the plugin init function
A plugin init function can get the plugin config entry (that is, its own
config entry) by using the pblock parameter SLAPI_PLUGIN_CONFIG_ENTRY
int
my_plugin_init(Slapi_PBlock *pb)
{
Slapi_Entry *my_config_entry = NULL;
slapi_pblock_get(pb, SLAPI_PLUGIN_CONFIG_ENTRY, my_config_entry);
---
ldap/servers/slapd/plugin.c |1 +
ldap/servers/slapd/plugin_internal_op.c | 14 +-
ldap/servers/slapd/slapi-plugin.h |5 +
3 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/ldap/servers/slapd/plugin.c b/ldap/servers/slapd/plugin.c
index c145eff..19d6d38 100644
--- a/ldap/servers/slapd/plugin.c
+++ b/ldap/servers/slapd/plugin.c
@@ -2294,6 +2294,7 @@ plugin_setup(Slapi_Entry *plugin_entry, struct slapi_componentid *group,
}
slapi_pblock_set(pb, SLAPI_PLUGIN_ENABLED, enabled);
+ slapi_pblock_set(pb, SLAPI_PLUGIN_CONFIG_ENTRY, plugin_entry);
if ((*initfunc)(pb) != 0)
{
diff --git a/ldap/servers/slapd/plugin_internal_op.c b/ldap/servers/slapd/plugin_internal_op.c
index 75d4e4a..c8e6000 100644
--- a/ldap/servers/slapd/plugin_internal_op.c
+++ b/ldap/servers/slapd/plugin_internal_op.c
@@ -876,7 +876,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( Slapi_DN *dn, char ** attrs, Slapi_Entry **ret_entry , void * component_identity)
+slapi_search_internal_get_entry_ext( Slapi_DN *dn, char ** attrs, Slapi_Entry **ret_entry , void * component_identity, void *txn )
{
Slapi_Entry **entries = NULL;
Slapi_PBlock *int_search_pb = NULL;
@@ -892,6 +892,7 @@ slapi_search_internal_get_entry( Slapi_DN *dn, char ** attrs, Slapi_Entry **ret_
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 ) {
@@ -913,3 +914,14 @@ slapi_search_internal_get_entry( Slapi_DN *dn, char ** attrs, Slapi_Entry **ret_
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 4764e50..862a23b