summaryrefslogtreecommitdiffstats
path: root/ldap
diff options
context:
space:
mode:
authorNoriko Hosoi <nhosoi@redhat.com>2006-12-08 18:11:09 +0000
committerNoriko Hosoi <nhosoi@redhat.com>2006-12-08 18:11:09 +0000
commitd0a8ec609189280426659038d1e144cfbda132a0 (patch)
tree6ac32ed5d83ab3af4bd6d0a28b80711f9c4632d5 /ldap
parent199480487674a0b6bafaf359be27bc2af8b313f4 (diff)
downloadds-d0a8ec609189280426659038d1e144cfbda132a0.tar.gz
ds-d0a8ec609189280426659038d1e144cfbda132a0.tar.xz
ds-d0a8ec609189280426659038d1e144cfbda132a0.zip
Resolves: #202843
Summary: referential integrity plugin does not stack with Class of Service appliance (Comment #11) Changes: 1) registered cos_post_op and roles_post_op as SLAPI_PLUGIN_INTERNAL_POST_op_FN functions. 2) changed the plugin type of CoS and Roles from "postoperation" to "object".
Diffstat (limited to 'ldap')
-rw-r--r--ldap/admin/src/create_instance.c4
-rw-r--r--ldap/servers/plugins/cos/cos.c100
-rw-r--r--ldap/servers/plugins/roles/roles_plugin.c90
3 files changed, 149 insertions, 45 deletions
diff --git a/ldap/admin/src/create_instance.c b/ldap/admin/src/create_instance.c
index eb3018f5..404dc610 100644
--- a/ldap/admin/src/create_instance.c
+++ b/ldap/admin/src/create_instance.c
@@ -2949,7 +2949,7 @@ char *ds_gen_confs(char *sroot, server_config_s *cf, char *cs_path)
fprintf(f, "cn: Roles Plugin\n");
fprintf(f, "nsslapd-pluginpath: %s/libroles-plugin%s\n", cf->plugin_dir, shared_lib);
fprintf(f, "nsslapd-plugininitfunc: roles_init\n");
- fprintf(f, "nsslapd-plugintype: postoperation\n");
+ fprintf(f, "nsslapd-plugintype: object\n");
fprintf(f, "nsslapd-pluginenabled: on\n");
fprintf(f, "nsslapd-plugin-depends-on-type: database\n");
fprintf(f, "nsslapd-plugin-depends-on-named: State Change Plugin\n");
@@ -3027,7 +3027,7 @@ char *ds_gen_confs(char *sroot, server_config_s *cf, char *cs_path)
fprintf(f, "cn: Class of Service\n");
fprintf(f, "nsslapd-pluginpath: %s/libcos-plugin%s\n", cf->plugin_dir, shared_lib);
fprintf(f, "nsslapd-plugininitfunc: cos_init\n");
- fprintf(f, "nsslapd-plugintype: postoperation\n");
+ fprintf(f, "nsslapd-plugintype: object\n");
fprintf(f, "nsslapd-pluginenabled: on\n");
fprintf(f, "nsslapd-plugin-depends-on-type: database\n");
fprintf(f, "nsslapd-plugin-depends-on-named: State Change Plugin\n");
diff --git a/ldap/servers/plugins/cos/cos.c b/ldap/servers/plugins/cos/cos.c
index aa1c2ffc..2a4f8810 100644
--- a/ldap/servers/plugins/cos/cos.c
+++ b/ldap/servers/plugins/cos/cos.c
@@ -168,6 +168,52 @@ int cos_version()
return COS_VERSION;
}
+int
+cos_postop_init ( Slapi_PBlock *pb )
+{
+ int rc = 0;
+
+ if ( slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
+ SLAPI_PLUGIN_VERSION_01 ) != 0 ||
+ slapi_pblock_set(pb, SLAPI_PLUGIN_POST_MODIFY_FN,
+ (void *)cos_post_op ) != 0 ||
+ slapi_pblock_set(pb, SLAPI_PLUGIN_POST_MODRDN_FN,
+ (void *)cos_post_op ) != 0 ||
+ slapi_pblock_set(pb, SLAPI_PLUGIN_POST_ADD_FN,
+ (void *) cos_post_op ) != 0 ||
+ slapi_pblock_set(pb, SLAPI_PLUGIN_POST_DELETE_FN,
+ (void *) cos_post_op ) != 0 )
+ {
+ slapi_log_error( SLAPI_LOG_FATAL, COS_PLUGIN_SUBSYSTEM,
+ "cos_postop_init: failed to register plugin\n" );
+ rc = -1;
+ }
+ return rc;
+}
+
+int
+cos_internalpostop_init ( Slapi_PBlock *pb )
+{
+ int rc = 0;
+
+ if ( slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
+ SLAPI_PLUGIN_VERSION_01 ) != 0 ||
+ slapi_pblock_set(pb, SLAPI_PLUGIN_INTERNAL_POST_MODIFY_FN,
+ (void *)cos_post_op ) != 0 ||
+ slapi_pblock_set(pb, SLAPI_PLUGIN_INTERNAL_POST_MODRDN_FN,
+ (void *)cos_post_op ) != 0 ||
+ slapi_pblock_set(pb, SLAPI_PLUGIN_INTERNAL_POST_ADD_FN,
+ (void *) cos_post_op ) != 0 ||
+ slapi_pblock_set(pb, SLAPI_PLUGIN_INTERNAL_POST_DELETE_FN,
+ (void *) cos_post_op ) != 0 )
+ {
+ slapi_log_error( SLAPI_LOG_FATAL, COS_PLUGIN_SUBSYSTEM,
+ "cos_internalpostop_init: failed to register plugin\n" );
+ rc = -1;
+ }
+ return rc;
+}
+
/*
cos_init
--------
@@ -185,37 +231,43 @@ int cos_init( Slapi_PBlock *pb )
** Used for internal operations
*/
- slapi_pblock_get (pb, SLAPI_PLUGIN_IDENTITY, &plugin_identity);
- PR_ASSERT (plugin_identity);
+ slapi_pblock_get (pb, SLAPI_PLUGIN_IDENTITY, &plugin_identity);
+ PR_ASSERT (plugin_identity);
cos_set_plugin_identity(plugin_identity);
- if ( slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
- SLAPI_PLUGIN_VERSION_01 ) != 0 ||
- slapi_pblock_set(pb, SLAPI_PLUGIN_START_FN,
- (void *) cos_start ) != 0 ||
- slapi_pblock_set(pb, SLAPI_PLUGIN_POST_MODIFY_FN,
- (void *) cos_post_op ) != 0 ||
- slapi_pblock_set(pb, SLAPI_PLUGIN_POST_MODRDN_FN,
- (void *) cos_post_op ) != 0 ||
- slapi_pblock_set(pb, SLAPI_PLUGIN_POST_ADD_FN,
- (void *) cos_post_op ) != 0 ||
- slapi_pblock_set(pb, SLAPI_PLUGIN_POST_DELETE_FN,
- (void *) cos_post_op ) != 0 ||
- slapi_pblock_set(pb, SLAPI_PLUGIN_CLOSE_FN,
- (void *) cos_close ) != 0 ||
- slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION,
- (void *)&pdesc ) != 0 )
- {
- slapi_log_error( SLAPI_LOG_FATAL, COS_PLUGIN_SUBSYSTEM,
- "cos_init: failed to register plugin\n" );
+ if ( slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
+ SLAPI_PLUGIN_VERSION_01 ) != 0 ||
+ slapi_pblock_set(pb, SLAPI_PLUGIN_START_FN,
+ (void *) cos_start ) != 0 ||
+ slapi_pblock_set(pb, SLAPI_PLUGIN_CLOSE_FN,
+ (void *) cos_close ) != 0 ||
+ slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION,
+ (void *)&pdesc ) != 0 )
+ {
+ slapi_log_error( SLAPI_LOG_FATAL, COS_PLUGIN_SUBSYSTEM,
+ "cos_init: failed to register plugin\n" );
ret = -1;
- }
+ goto bailout;
+ }
+
+ ret = slapi_register_plugin("postoperation", 1 /* Enabled */,
+ "cos_postop_init", cos_postop_init,
+ "Class of Service postoperation plugin", NULL,
+ plugin_identity);
+ if ( ret < 0 ) {
+ goto bailout;
+ }
+
+ ret = slapi_register_plugin("internalpostoperation", 1 /* Enabled */,
+ "cos_internalpostop_init", cos_internalpostop_init,
+ "Class of Service internalpostoperation plugin", NULL,
+ plugin_identity);
+bailout:
LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_init\n",0,0,0);
- return ret;
+ return ret;
}
-
/*
cos_start
---------
diff --git a/ldap/servers/plugins/roles/roles_plugin.c b/ldap/servers/plugins/roles/roles_plugin.c
index e5d8f4ca..4db36c42 100644
--- a/ldap/servers/plugins/roles/roles_plugin.c
+++ b/ldap/servers/plugins/roles/roles_plugin.c
@@ -83,6 +83,52 @@ static int roles_post_op( Slapi_PBlock *pb );
static int roles_close( Slapi_PBlock *pb );
static void roles_set_plugin_identity(void * identity);
+int
+roles_postop_init ( Slapi_PBlock *pb )
+{
+ int rc = 0;
+
+ if ( slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
+ SLAPI_PLUGIN_VERSION_01 ) != 0 ||
+ slapi_pblock_set(pb, SLAPI_PLUGIN_POST_MODIFY_FN,
+ (void *)roles_post_op ) != 0 ||
+ slapi_pblock_set(pb, SLAPI_PLUGIN_POST_MODRDN_FN,
+ (void *)roles_post_op ) != 0 ||
+ slapi_pblock_set(pb, SLAPI_PLUGIN_POST_ADD_FN,
+ (void *) roles_post_op ) != 0 ||
+ slapi_pblock_set(pb, SLAPI_PLUGIN_POST_DELETE_FN,
+ (void *) roles_post_op ) != 0 )
+ {
+ slapi_log_error( SLAPI_LOG_FATAL, ROLES_PLUGIN_SUBSYSTEM,
+ "roles_postop_init: failed to register plugin\n" );
+ rc = -1;
+ }
+ return rc;
+}
+
+int
+roles_internalpostop_init ( Slapi_PBlock *pb )
+{
+ int rc = 0;
+
+ if ( slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
+ SLAPI_PLUGIN_VERSION_01 ) != 0 ||
+ slapi_pblock_set(pb, SLAPI_PLUGIN_INTERNAL_POST_MODIFY_FN,
+ (void *)roles_post_op ) != 0 ||
+ slapi_pblock_set(pb, SLAPI_PLUGIN_INTERNAL_POST_MODRDN_FN,
+ (void *)roles_post_op ) != 0 ||
+ slapi_pblock_set(pb, SLAPI_PLUGIN_INTERNAL_POST_ADD_FN,
+ (void *) roles_post_op ) != 0 ||
+ slapi_pblock_set(pb, SLAPI_PLUGIN_INTERNAL_POST_DELETE_FN,
+ (void *) roles_post_op ) != 0 )
+ {
+ slapi_log_error( SLAPI_LOG_FATAL, ROLES_PLUGIN_SUBSYSTEM,
+ "roles_internalpostop_init: failed to register plugin\n" );
+ rc = -1;
+ }
+ return rc;
+}
+
/* roles_init
----------
Initialization of the plugin
@@ -93,36 +139,42 @@ int roles_init( Slapi_PBlock *pb )
void *plugin_identity = NULL;
slapi_log_error( SLAPI_LOG_PLUGIN, ROLES_PLUGIN_SUBSYSTEM,
- "=> roles_init\n" );
+ "=> roles_init\n" );
slapi_pblock_get (pb, SLAPI_PLUGIN_IDENTITY, &plugin_identity);
PR_ASSERT (plugin_identity);
roles_set_plugin_identity(plugin_identity);
- if ( slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
- (void *)SLAPI_PLUGIN_VERSION_01 ) != 0 ||
- slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION,
- (void *)&pdesc ) != 0 ||
- slapi_pblock_set( pb, SLAPI_PLUGIN_START_FN,
- (void *)roles_start ) != 0 ||
- slapi_pblock_set(pb, SLAPI_PLUGIN_POST_MODIFY_FN,
- (void *) roles_post_op ) != 0 ||
- slapi_pblock_set(pb, SLAPI_PLUGIN_POST_MODRDN_FN,
- (void *) roles_post_op ) != 0 ||
- slapi_pblock_set(pb, SLAPI_PLUGIN_POST_ADD_FN,
- (void *) roles_post_op ) != 0 ||
- slapi_pblock_set(pb, SLAPI_PLUGIN_POST_DELETE_FN,
- (void *) roles_post_op ) != 0 ||
- slapi_pblock_set(pb, SLAPI_PLUGIN_CLOSE_FN,
- (void *) roles_close ) != 0 )
+ if ( slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
+ (void *)SLAPI_PLUGIN_VERSION_01 ) != 0 ||
+ slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION,
+ (void *)&pdesc ) != 0 ||
+ slapi_pblock_set( pb, SLAPI_PLUGIN_START_FN,
+ (void *)roles_start ) != 0 ||
+ slapi_pblock_set(pb, SLAPI_PLUGIN_CLOSE_FN,
+ (void *) roles_close ) != 0 )
{
slapi_log_error( SLAPI_LOG_FATAL, ROLES_PLUGIN_SUBSYSTEM,
"roles_init failed\n" );
rc = -1;
- }
+ goto bailout;
+ }
+
+ rc = slapi_register_plugin("postoperation", 1 /* Enabled */,
+ "roles_postop_init", roles_postop_init,
+ "Roles postoperation plugin", NULL,
+ plugin_identity);
+ if ( rc < 0 ) {
+ goto bailout;
+ }
+ rc = slapi_register_plugin("internalpostoperation", 1 /* Enabled */,
+ "roles_internalpostop_init", roles_internalpostop_init,
+ "Roles internalpostoperation plugin", NULL,
+ plugin_identity);
+bailout:
slapi_log_error( SLAPI_LOG_PLUGIN, ROLES_PLUGIN_SUBSYSTEM,
- "<= roles_init %d\n", rc );
+ "<= roles_init %d\n", rc );
return rc;
}