diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/back-nis.c | 10 | ||||
-rw-r--r-- | src/back-sch.c | 10 | ||||
-rw-r--r-- | src/back-shr.c | 34 | ||||
-rw-r--r-- | src/back-shr.h | 3 | ||||
-rw-r--r-- | src/backend.h | 3 | ||||
-rw-r--r-- | src/plug-nis.c | 28 | ||||
-rw-r--r-- | src/plug-sch.c | 28 |
7 files changed, 116 insertions, 0 deletions
diff --git a/src/back-nis.c b/src/back-nis.c index 1e9381c..803cf61 100644 --- a/src/back-nis.c +++ b/src/back-nis.c @@ -970,3 +970,13 @@ backend_init_internal_postop(Slapi_PBlock *pb, struct plugin_state *state) "hooking up internal postoperation callbacks\n"); return backend_shr_internal_postop_init(pb, state); } + +#ifdef USE_SLAPI_BE_TXNS +int +backend_init_be_txn_postop(Slapi_PBlock *pb, struct plugin_state *state) +{ + slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id, + "hooking up be-txn postoperation callbacks\n"); + return backend_shr_be_txn_postop_init(pb, state); +} +#endif diff --git a/src/back-sch.c b/src/back-sch.c index d166581..dedb50a 100644 --- a/src/back-sch.c +++ b/src/back-sch.c @@ -1333,3 +1333,13 @@ backend_init_internal_postop(Slapi_PBlock *pb, struct plugin_state *state) "hooking up internal postoperation callbacks\n"); return backend_shr_internal_postop_init(pb, state); } + +#ifdef USE_SLAPI_BE_TXNS +int +backend_init_be_txn_postop(Slapi_PBlock *pb, struct plugin_state *state) +{ + slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id, + "hooking up be-txn postoperation callbacks\n"); + return backend_shr_be_txn_postop_init(pb, state); +} +#endif diff --git a/src/back-shr.c b/src/back-shr.c index c9f46a6..5697a9e 100644 --- a/src/back-shr.c +++ b/src/back-shr.c @@ -1952,3 +1952,37 @@ backend_shr_internal_postop_init(Slapi_PBlock *pb, struct plugin_state *state) } return 0; } + +#ifdef USE_SLAPI_BE_TXNS +int +backend_shr_be_txn_postop_init(Slapi_PBlock *pb, struct plugin_state *state) +{ +#if 0 + if (slapi_pblock_set(pb, SLAPI_PLUGIN_BE_TXN_POST_ADD_FN, + backend_shr_add_cb) != 0) { + slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id, + "error hooking up be-txn-post add callback\n"); + return -1; + } + if (slapi_pblock_set(pb, SLAPI_PLUGIN_BE_TXN_POST_MODIFY_FN, + backend_shr_modify_cb) != 0) { + slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id, + "error hooking up be-txn-post modify callback\n"); + return -1; + } + if (slapi_pblock_set(pb, SLAPI_PLUGIN_BE_TXN_POST_MODRDN_FN, + backend_shr_modrdn_cb) != 0) { + slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id, + "error hooking up be-txn-post modrdn callback\n"); + return -1; + } + if (slapi_pblock_set(pb, SLAPI_PLUGIN_BE_TXN_POST_DELETE_FN, + backend_shr_delete_cb) != 0) { + slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id, + "error hooking up be-txn-post delete callback\n"); + return -1; + } +#endif + return 0; +} +#endif diff --git a/src/back-shr.h b/src/back-shr.h index e0b21b9..4e56605 100644 --- a/src/back-shr.h +++ b/src/back-shr.h @@ -36,6 +36,9 @@ void backend_shr_add_strlist(char ***strlist, const char *item); void backend_shr_startup(struct plugin_state *state, const char *set_filter); int backend_shr_postop_init(Slapi_PBlock *pb, struct plugin_state *state); int backend_shr_internal_postop_init(Slapi_PBlock *pb, struct plugin_state *state); +#ifdef USE_SLAPI_BE_TXNS +int backend_shr_be_txn_postop_init(Slapi_PBlock *pb, struct plugin_state *state); +#endif int backend_shr_set_config_entry_add(struct plugin_state *state, Slapi_Entry *e, diff --git a/src/backend.h b/src/backend.h index 73ae182..a2b1f58 100644 --- a/src/backend.h +++ b/src/backend.h @@ -51,6 +51,9 @@ void backend_startup(struct plugin_state *state); int backend_init_preop(struct slapi_pblock *pb, struct plugin_state *state); int backend_init_postop(struct slapi_pblock *pb, struct plugin_state *state); int backend_init_internal_postop(struct slapi_pblock *pb, struct plugin_state *state); +#ifdef USE_SLAPI_BE_TXNS +int backend_init_be_txn_postop(struct slapi_pblock *pb, struct plugin_state *state); +#endif /* Read the server's name. */ int backend_read_master_name(struct plugin_state *state, char **master); diff --git a/src/plug-nis.c b/src/plug-nis.c index c6fa274..24098ae 100644 --- a/src/plug-nis.c +++ b/src/plug-nis.c @@ -60,6 +60,7 @@ #define PLUGIN_ID "nis-server-plugin" #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 @@ -462,6 +463,22 @@ nis_plugin_init_internal_postop(Slapi_PBlock *pb) } return 0; } +#ifdef USE_SLAPI_BE_TXNS +static int +nis_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 nis_plugin_init(Slapi_PBlock *pb) { @@ -500,6 +517,17 @@ nis_plugin_init(Slapi_PBlock *pb) "error registering internal postoperation plugin\n"); return -1; } +#ifdef USE_SLAPI_BE_TXNS + if (slapi_register_plugin("betxnpostoperation", TRUE, + "nis_plugin_init_be_txn_postop", + nis_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; 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; |