Setting Data In The Parameter Block - Netscape DIRECTORY SERVER 6.01 - PLUG-IN Manual

Table of Contents

Advertisement

Writing a Plug-In Function
Code Example 2-1
/* 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 );
}
In this code example,
parameter block that contains the base DN of the search. For a complete listing of
the parameter block IDs, see Chapter 15, "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()
the value of the
plug-in.
In the following example, the
SLAPI_PRIVATE
Code Example 2-2
#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",
30
Netscape Directory Server Plug-In Programmer's Guide • January 2002
Getting Data From the Parameter Block (Continued)
SLAPI_SEARCH_TARGET
. For example, you call can
SLAPI_PRIVATE
parameter to the context of the database.
Setting Values in the Parameter Block
identifies the parameter in the
slapi_pblock_set()
parameter, which stores private data for the
function sets the value of the
ldif_back_init()
to change

Advertisement

Table of Contents
loading

This manual is also suitable for:

Directory server 6.01

Table of Contents