summaryrefslogtreecommitdiffstats
path: root/src/back-shr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/back-shr.c')
-rw-r--r--src/back-shr.c47
1 files changed, 31 insertions, 16 deletions
diff --git a/src/back-shr.c b/src/back-shr.c
index a2c31c9..99955b6 100644
--- a/src/back-shr.c
+++ b/src/back-shr.c
@@ -2245,26 +2245,40 @@ backend_shr_internal_delete_cb(Slapi_PBlock *pb)
int
backend_shr_postop_init(Slapi_PBlock *pb, struct plugin_state *state)
{
- if (slapi_pblock_set(pb, SLAPI_PLUGIN_POST_ADD_FN,
- backend_shr_add_cb) != 0) {
+ int addfn = SLAPI_PLUGIN_POST_ADD_FN;
+ int modfn = SLAPI_PLUGIN_POST_MODIFY_FN;
+ int mdnfn = SLAPI_PLUGIN_POST_MODRDN_FN;
+ int delfn = SLAPI_PLUGIN_POST_DELETE_FN;
+ Slapi_Entry *plugin_entry = NULL;
+ char *plugin_type = NULL;
+
+ if ((slapi_pblock_get(pb, SLAPI_PLUGIN_CONFIG_ENTRY, &plugin_entry) == 0) &&
+ plugin_entry &&
+ (plugin_type = slapi_entry_attr_get_charptr(plugin_entry, "nsslapd-plugintype")) &&
+ plugin_type && strstr(plugin_type, "betxn")) {
+ addfn = SLAPI_PLUGIN_BE_TXN_POST_ADD_FN;
+ modfn = SLAPI_PLUGIN_BE_TXN_POST_MODIFY_FN;
+ mdnfn = SLAPI_PLUGIN_BE_TXN_POST_MODRDN_FN;
+ delfn = SLAPI_PLUGIN_BE_TXN_POST_DELETE_FN;
+ }
+ slapi_ch_free_string(&plugin_type);
+
+ if (slapi_pblock_set(pb, addfn, backend_shr_add_cb) != 0) {
slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
"error hooking up add callback\n");
return -1;
}
- if (slapi_pblock_set(pb, SLAPI_PLUGIN_POST_MODIFY_FN,
- backend_shr_modify_cb) != 0) {
+ if (slapi_pblock_set(pb, modfn, backend_shr_modify_cb) != 0) {
slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
"error hooking up modify callback\n");
return -1;
}
- if (slapi_pblock_set(pb, SLAPI_PLUGIN_POST_MODRDN_FN,
- backend_shr_modrdn_cb) != 0) {
+ if (slapi_pblock_set(pb, mdnfn, backend_shr_modrdn_cb) != 0) {
slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
"error hooking up modrdn callback\n");
return -1;
}
- if (slapi_pblock_set(pb, SLAPI_PLUGIN_POST_DELETE_FN,
- backend_shr_delete_cb) != 0) {
+ if (slapi_pblock_set(pb, delfn, backend_shr_delete_cb) != 0) {
slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
"error hooking up delete callback\n");
return -1;
@@ -2275,26 +2289,27 @@ backend_shr_postop_init(Slapi_PBlock *pb, struct plugin_state *state)
int
backend_shr_internal_postop_init(Slapi_PBlock *pb, struct plugin_state *state)
{
- if (slapi_pblock_set(pb, SLAPI_PLUGIN_INTERNAL_POST_ADD_FN,
- backend_shr_internal_add_cb) != 0) {
+ int addfn = SLAPI_PLUGIN_INTERNAL_POST_ADD_FN;
+ int modfn = SLAPI_PLUGIN_INTERNAL_POST_MODIFY_FN;
+ int mdnfn = SLAPI_PLUGIN_INTERNAL_POST_MODRDN_FN;
+ int delfn = SLAPI_PLUGIN_INTERNAL_POST_DELETE_FN;
+
+ if (slapi_pblock_set(pb, addfn, backend_shr_internal_add_cb) != 0) {
slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
"error hooking up internal add callback\n");
return -1;
}
- if (slapi_pblock_set(pb, SLAPI_PLUGIN_INTERNAL_POST_MODIFY_FN,
- backend_shr_internal_modify_cb) != 0) {
+ if (slapi_pblock_set(pb, modfn, backend_shr_internal_modify_cb) != 0) {
slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
"error hooking up internal modify callback\n");
return -1;
}
- if (slapi_pblock_set(pb, SLAPI_PLUGIN_INTERNAL_POST_MODRDN_FN,
- backend_shr_internal_modrdn_cb) != 0) {
+ if (slapi_pblock_set(pb, mdnfn, backend_shr_internal_modrdn_cb) != 0) {
slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
"error hooking up internal modrdn callback\n");
return -1;
}
- if (slapi_pblock_set(pb, SLAPI_PLUGIN_INTERNAL_POST_DELETE_FN,
- backend_shr_internal_delete_cb) != 0) {
+ if (slapi_pblock_set(pb, delfn, backend_shr_internal_delete_cb) != 0) {
slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
"error hooking up internal delete callback\n");
return -1;