HP-UX Directory Server 8.1 plug-in reference

Table Of Contents
Table 13-2 Elements of preoperation plug-in
DescriptionElement
#define PLUGIN_NAME "nullsuffix-preop"
static Slapi_PluginDesc plugindesc =
{ PLUGIN_NAME, PLUGIN_VENDOR, PLUGIN_VERSION, "sample preoperation null suffix
plugin" };
Description of the plug-in
nullsuffix_init( Slapi_PBlock *pb )
In this function, all the callbacks are set up and will be called by the server for each
LDAP operation.
CallbackFlag used for LDAP operation
nullsuffix_searchSLAPI_PLUGIN_PRE_SEARCH_FN
nullsuffix_addSLAPI_PLUGIN_PRE_ADD_FN
nullsuffix_modifySLAPI_PLUGIN_PRE_MODIFY_FN
nullsuffix_deleteSLAPI_PLUGIN_PRE_DELETE_FN
nullsuffix_bindSLAPI_PLUGIN_PRE_BIND_FN
nullsuffix_modrdnSLAPI_PLUGIN_PRE_MODRDN_FN
Initialization of the plug-in
by the server
“slapi_op_reserved()” is called to determine whether the operation should be handled
internally by Directory Server; for example, whether the base on which the operation
is applied is a reserved naming context. If returns a nonzero value, the plug-in does
not attempt to handle that operation. This is performed by the following code snippet:
if( slapi_op_reserved(pb) ) {
return PLUGIN_OPERATION_IGNORED;
}
Refer to testdatainterop.c for details.
The “slapi_op_reserved()” function, which can be used for reserving some of the naming
contexts in the Directory Server (cn=schema,cn=config,cn=monitor), is called
first in the database plug-in, then the call for turning off access control.
Reserved Naming Contexts
(cn=schema,
cn=config,
cn=monitor)
Any modifications done to the server on the null suffix are processed by the plug-in.
The plug-in writes the DN of all modifications received to a standalone BerkleyDB,
and trying a simple test using LDIF entries without the required object classes or parent
entries will still get processed by the server, populating the database created by the
plug-in. See nullsuffix_modify and testdbinterop.c for details. The plug-in
has not been coded for the retrieval of those entries but has been coded to demonstrate
sparse tree support only.
Sparse Tree Support
Switching off access control for the operation is done by:
slapi_operation_set_flag(op, SLAPI_OP_FLAG_NO_ACCESS_CHECK ); See
testdatainterop.c for details.
Access Control
The plug-in cannot control the support for null-suffix in the server. The support for
null-suffix is done through configuration modification of the server as shown in “Sample
DIOP plug-in”.
Null Suffix Support
Example to generate the libtest-plugin.so library:
cd /opt/dirsrv/devel/example && make
Building the Data
Interoperability Plug-in
13.4.1 Debugging the plug-in
If you need to debug the plug-in , you can use gdb:
1. cd /opt/dirsrv/sbin
2. export LD_LIBRARY_PATH=/opt/dirsrv/lib
3. gdb ns-slapd
13.4 Sample DIOP plug-in 113