Writing a Plug-In Function
30
Netscape Directory Server Plug-In Programmer’s Guide • December 2003
In this code example,
SLAPI_SEARCH_TARGET
identifies the parameter in the
parameter block that contains the base DN of the search. For a complete listing of
the parameter block IDs, see Chapter 16, “Parameter Block Reference.”
Setting Data in the Parameter Block
To modify the value of a parameter in the parameter block, call the function
slapi_pblock_set()
. For example, you call can
slapi_pblock_set()
to change
the value of the
SLAPI_PRIVATE
parameter, which stores private data for the
plug-in.
In the following example, the
ldif_back_init()
function sets the value of the
SLAPI_PRIVATE
parameter to the context of the database.
/* Indicate the point when the plug-in starts executing */
slapi_log_error( SLAPI_LOG_PLUGIN, "searchdn_preop_search",
"*** PREOPERATION SEARCH PLUGIN ***\n");
/* Get the base DN of the search from the parameter block. */
slapi_pblock_get( pb, SLAPI_SEARCH_TARGET, &dn );
/* Normalize the DN (the actual DN, not a copy of it)
and convert it to lowercase */
slapi_dn_normalize_case( dn );
/* Log the normalized DN */
slapi_log_error( SLAPI_LOG_PLUGIN, "searchdn_preop_search",
"Normalized DN: %s\n", dn );
return( 0 );
}
Code Example 2-2
Setting Values in the Parameter Block
#include <slapi-plugin.h>
...
int
ldif_back_init( Slapi_PBlock *pb )
{
LDIF *db; /* context of the database */
...
/* Allocate space for the database context, which contains
information about the database and a pointer to the list
of entries. */
if ( slapi_pblock_set( pb, SLAPI_PRIVATE, (void *) db ) == -1 )
{
slapi_log_error( SLAPI_LOG_PLUGIN, "ldif_back_init",
Code Example 2-1
Getting Data From the Parameter Block (Continued)
Summary of Contents for NETSCAPE DIRECTORY SERVER 6.2 - GATEWAY CUSTOMIZATION
Page 1: ...Plug In Programmer s Guide Netscape Directory Server Version6 2 December 2003...
Page 18: ...18 Netscape Directory Server Plug In Programmer s Guide December 2003...
Page 56: ...56 Netscape Directory Server Plug In Programmer s Guide December 2003...
Page 112: ...112 Netscape Directory Server Plug In Programmer s Guide December 2003...
Page 168: ...Plug In API Reference 168 Netscape Directory Server Plug In Programmer s Guide December 2003...
Page 170: ...170 Netscape Directory Server Plug In Programmer s Guide December 2003...
Page 600: ...600 Netscape Directory Server Plug In Programmer s Guide December 2003...
Page 612: ...612 Netscape Directory Server Plug In Programmer s Guide December 2003...