diff options
author | Nalin Dahyabhai <nalin@redhat.com> | 2012-01-09 15:02:20 -0500 |
---|---|---|
committer | Nalin Dahyabhai <nalin@redhat.com> | 2012-01-09 15:02:20 -0500 |
commit | d4e45d47a737b3af775c62a8ed50c5e646829284 (patch) | |
tree | 8e72a8fc0fc560080b2edd58003091ea095ddf0e /src/plug-sch.c | |
parent | ec00275ed1173caac8bc1f5b5a1a45d9c3bb25a5 (diff) | |
download | slapi-nis-d4e45d47a737b3af775c62a8ed50c5e646829284.tar.gz slapi-nis-d4e45d47a737b3af775c62a8ed50c5e646829284.tar.xz slapi-nis-d4e45d47a737b3af775c62a8ed50c5e646829284.zip |
- most of what's needed to hook back-end txn postoperations, except for the passing the TXN ID around, which means we deadlock if we actually do it
Diffstat (limited to 'src/plug-sch.c')
-rw-r--r-- | src/plug-sch.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/plug-sch.c b/src/plug-sch.c index 0cb4fab..160aa3e 100644 --- a/src/plug-sch.c +++ b/src/plug-sch.c @@ -60,6 +60,7 @@ #define PLUGIN_PREOP_ID PLUGIN_ID "-preop" #define PLUGIN_POSTOP_ID PLUGIN_ID "-postop" #define PLUGIN_INTERNAL_POSTOP_ID PLUGIN_ID "-internal-postop" +#define PLUGIN_BE_TXN_POSTOP_ID PLUGIN_ID "-be-txn-postop" /* the module initialization function */ static Slapi_PluginDesc @@ -165,6 +166,22 @@ schema_compat_plugin_init_internal_postop(Slapi_PBlock *pb) } return 0; } +#ifdef USE_SLAPI_BE_TXNS +static int +schema_compat_plugin_init_be_txn_postop(Slapi_PBlock *pb) +{ + slapi_pblock_set(pb, SLAPI_PLUGIN_VERSION, SLAPI_PLUGIN_VERSION_03); + slapi_pblock_set(pb, SLAPI_PLUGIN_DESCRIPTION, &plugin_description); + slapi_pblock_set(pb, SLAPI_PLUGIN_PRIVATE, global_plugin_state); + if (backend_init_be_txn_postop(pb, global_plugin_state) == -1) { + slapi_log_error(SLAPI_LOG_PLUGIN, + global_plugin_state->plugin_desc->spd_id, + "error registering be-txn postop hooks\n"); + return -1; + } + return 0; +} +#endif int schema_compat_plugin_init(Slapi_PBlock *pb) { @@ -212,6 +229,17 @@ schema_compat_plugin_init(Slapi_PBlock *pb) "error registering internal postoperation plugin\n"); return -1; } +#ifdef USE_SLAPI_BE_TXNS + if (slapi_register_plugin("betxnpostoperation", TRUE, + "schema_compat_plugin_init_be_txn_postop", + schema_compat_plugin_init_be_txn_postop, + PLUGIN_BE_TXN_POSTOP_ID, NULL, + state->plugin_identity) != 0) { + slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id, + "error registering be-txn postoperation plugin\n"); + return -1; + } +#endif slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id, "registered plugin hooks\n"); global_plugin_state = NULL; |