From 02af93ff6a15d263f3d44067e9f1dbcbff9eb4f8 Mon Sep 17 00:00:00 2001 From: Noriko Hosoi Date: Thu, 9 Jun 2005 18:35:02 +0000 Subject: Added testpreop_search to verify bug 147585 Plus fixed branding/version number. --- ldap/servers/slapd/test-plugins/testbind.c | 2 +- ldap/servers/slapd/test-plugins/testdatainterop.c | 6 +++--- ldap/servers/slapd/test-plugins/testentry.c | 2 +- ldap/servers/slapd/test-plugins/testextendedop.c | 2 +- ldap/servers/slapd/test-plugins/testgetip.c | 2 +- ldap/servers/slapd/test-plugins/testpostop.c | 2 +- ldap/servers/slapd/test-plugins/testpreop.c | 25 +++++++++++++++++++++-- ldap/servers/slapd/test-plugins/testsaslbind.c | 2 +- 8 files changed, 32 insertions(+), 11 deletions(-) diff --git a/ldap/servers/slapd/test-plugins/testbind.c b/ldap/servers/slapd/test-plugins/testbind.c index d2fadc7d..08e12a0c 100644 --- a/ldap/servers/slapd/test-plugins/testbind.c +++ b/ldap/servers/slapd/test-plugins/testbind.c @@ -69,7 +69,7 @@ #include #include "slapi-plugin.h" -Slapi_PluginDesc bindpdesc = { "test-bind", "Netscape", "0.5", +Slapi_PluginDesc bindpdesc = { "test-bind", "Fedora Project", "7.1", "sample bind pre-operation plugin" }; static Slapi_ComponentId *plugin_id = NULL; diff --git a/ldap/servers/slapd/test-plugins/testdatainterop.c b/ldap/servers/slapd/test-plugins/testdatainterop.c index 728a146d..2c871838 100644 --- a/ldap/servers/slapd/test-plugins/testdatainterop.c +++ b/ldap/servers/slapd/test-plugins/testdatainterop.c @@ -88,8 +88,8 @@ nsslapd-pluginType: preoperation nsslapd-pluginEnabled: on nsslapd-pluginId: nullsuffix-preop - nsslapd-pluginVersion: 6.2 - nsslapd-pluginVendor: Netscape + nsslapd-pluginVersion: 7.1 + nsslapd-pluginVendor: Fedora Project nsslapd-pluginDescription: sample pre-operation null suffix plugin ******************************************/ @@ -113,7 +113,7 @@ /* * Static variables. */ -static Slapi_PluginDesc plugindesc = { PLUGIN_NAME, "Netscape", "0.5", +static Slapi_PluginDesc plugindesc = { PLUGIN_NAME, "Fedora Project", "7.1", "sample pre-operation null suffix plugin" }; static Slapi_ComponentId *plugin_id = NULL; diff --git a/ldap/servers/slapd/test-plugins/testentry.c b/ldap/servers/slapd/test-plugins/testentry.c index 72464d2b..fabb1a6e 100644 --- a/ldap/servers/slapd/test-plugins/testentry.c +++ b/ldap/servers/slapd/test-plugins/testentry.c @@ -90,7 +90,7 @@ nsslapd-pluginId: test-entry #include #include "slapi-plugin.h" -Slapi_PluginDesc entrypdesc = { "test-entry", "Netscape", "0.5", +Slapi_PluginDesc entrypdesc = { "test-entry", "Fedora Project", "7.1", "sample entry modification plugin" }; /* Entry store plug-in function */ diff --git a/ldap/servers/slapd/test-plugins/testextendedop.c b/ldap/servers/slapd/test-plugins/testextendedop.c index d6e0841d..5f5b638a 100644 --- a/ldap/servers/slapd/test-plugins/testextendedop.c +++ b/ldap/servers/slapd/test-plugins/testextendedop.c @@ -83,7 +83,7 @@ /* OID of the extended operation handled by this plug-in */ #define MY_OID "1.2.3.4" -Slapi_PluginDesc expdesc = { "test-extendedop", "Netscape", "0.5", +Slapi_PluginDesc expdesc = { "test-extendedop", "Fedora Project", "7.1", "sample extended operation plugin" }; diff --git a/ldap/servers/slapd/test-plugins/testgetip.c b/ldap/servers/slapd/test-plugins/testgetip.c index 8e781ee4..8867ee29 100644 --- a/ldap/servers/slapd/test-plugins/testgetip.c +++ b/ldap/servers/slapd/test-plugins/testgetip.c @@ -74,7 +74,7 @@ #include "slapi-plugin.h" #include "nspr.h" -Slapi_PluginDesc getippdesc = { "test-getip", "Netscape", "0.5", +Slapi_PluginDesc getippdesc = { "test-getip", "Fedora Project", "7.1", "sample pre-operation plugin" }; static char *netaddr2str( PRNetAddr *addrp, char *buf, size_t buflen ); diff --git a/ldap/servers/slapd/test-plugins/testpostop.c b/ldap/servers/slapd/test-plugins/testpostop.c index f5982592..7c82bf7f 100644 --- a/ldap/servers/slapd/test-plugins/testpostop.c +++ b/ldap/servers/slapd/test-plugins/testpostop.c @@ -93,7 +93,7 @@ static char changelogfile[MAX_PATH+1]; static char *changelogfile = "/tmp/changelog"; #endif -Slapi_PluginDesc postoppdesc = { "test-postop", "Netscape", "0.5", +Slapi_PluginDesc postoppdesc = { "test-postop", "Fedora Project", "7.1", "sample post-operation plugin" }; static void write_changelog( int optype, char *dn, void *change, int flag ); diff --git a/ldap/servers/slapd/test-plugins/testpreop.c b/ldap/servers/slapd/test-plugins/testpreop.c index af3ca1f4..c71fba29 100644 --- a/ldap/servers/slapd/test-plugins/testpreop.c +++ b/ldap/servers/slapd/test-plugins/testpreop.c @@ -45,6 +45,7 @@ * testpreop_bind (called before an LDAP bind operation) * testpreop_add (called before an LDAP add operation) + * testpreop_search (called before an LDAP search operation) * testpreop_abandon (called before an LDAP abandon operation) testpreop_bind logs information about the LDAP bind operation @@ -78,7 +79,7 @@ #include #include "slapi-plugin.h" -Slapi_PluginDesc preoppdesc = { "test-preop", "Netscape", "0.5", +Slapi_PluginDesc preoppdesc = { "test-preop", "Fedora Project", "7.1", "sample pre-operation plugin" }; /* Pre-operation plug-in function */ @@ -159,6 +160,24 @@ testpreop_add( Slapi_PBlock *pb ) return( 0 ); /* allow the operation to continue */ } +/* Pre-operation plug-in function */ +int +testpreop_search( Slapi_PBlock *pb ) +{ + char *base; + /* Log a message to indicate when the plug-in function starts */ + slapi_log_error( SLAPI_LOG_FATAL, "testpreop_search", + "*** PREOPERATION SEARCH PLUGIN ***\n"); + /* Get and log the base DN of the search criteria */ + if ( slapi_pblock_get( pb, SLAPI_SEARCH_TARGET, &base ) == 0 ) + slapi_log_error( SLAPI_LOG_FATAL, "SLAPI_SEARCH_TARGET", + "%s\n", base ); + /* Get and log the original base DN */ + if ( slapi_pblock_get( pb, SLAPI_ORIGINAL_TARGET_DN, &base ) == 0 ) + slapi_log_error( SLAPI_LOG_FATAL, "SLAPI_ORIGINAL_TARGET_DN", + "%s\n", base ); +} + /* Pre-operation plug-in function */ int @@ -236,9 +255,11 @@ testpreop_init( Slapi_PBlock *pb ) (void *) testpreop_bind ) != 0 || slapi_pblock_set( pb, SLAPI_PLUGIN_PRE_ADD_FN, (void *) testpreop_add ) != 0 || + slapi_pblock_set( pb, SLAPI_PLUGIN_PRE_SEARCH_FN, + (void *) testpreop_search ) != 0 || slapi_pblock_set( pb, SLAPI_PLUGIN_PRE_ABANDON_FN, (void *) testpreop_abandon ) != 0 ) { - slapi_log_error( SLAPI_LOG_PLUGIN, "testpreop_init", + slapi_log_error( SLAPI_LOG_FATAL, "testpreop_init", "Failed to set version and function\n" ); return( -1 ); } diff --git a/ldap/servers/slapd/test-plugins/testsaslbind.c b/ldap/servers/slapd/test-plugins/testsaslbind.c index 295e5d31..b259a80d 100644 --- a/ldap/servers/slapd/test-plugins/testsaslbind.c +++ b/ldap/servers/slapd/test-plugins/testsaslbind.c @@ -65,7 +65,7 @@ objectclass: top objectclass: nsSlapdPlugin objectclass: extensibleObject cn: test-saslbind -nsslapd-pluginpath: /usr/fedora/servers/plugins/slapd/slapi/examples/libtest-plugin.so +nsslapd-pluginpath: /plugins/slapd/slapi/examples/libtest-plugin.so nsslapd-plugininitfunc: testsasl_init nsslapd-plugintype: preoperation nsslapd-pluginenabled: on -- cgit