JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Directory Server Enterprise Edition Developer's Guide 11 g Release 1 (
search filter icon
search icon

Document Information


Part I Directory Server Plug-In API Guide

1.  Before You Start Writing Plug-Ins

2.  Changes to the Plug-In API Since Directory Server 5.2

3.  Getting Started With Directory Server Plug-Ins

4.  Working With Entries Using Plug-Ins

5.  Extending Client Request Handling Using Plug-Ins

Preoperation and Postoperation Plug-Ins

Preoperation Plug-Ins

Postoperation Plug-Ins

Registration Identifiers

Location of Plug-In Examples

Extending the Bind Operation

To Set Up an Example Suffix

Logging the Authentication Method

To Register the Plug-In

To Generate a Bind Log Message

Bypassing Bind Processing in Directory Server

Normal Directory Server Bind Behavior

Extending the Search Operation

Logging Who Requests a Search

Breaking Down a Search Filter

LOG Macros for Compact Code

Parameter Block Contents

Search Filter Info

Building a Filter Info

Normal Directory Server Search Behavior

Extending the Compare Operation

Extending the Add Operation

Prepending a String to an Attribute

Logging the Entry to Add

Extending the Modify Operation

Extending the Rename Operation

Extending the Delete Operation

Intercepting Information Sent to the Client

6.  Handling Authentication Using Plug-Ins

7.  Performing Internal Operations With Plug-Ins

8.  Writing Entry Store and Entry Fetch Plug-Ins

9.  Writing Extended Operation Plug-Ins

10.  Writing Matching Rule Plug-Ins

11.  Writing Password Storage Scheme Plug-Ins

12.  Writing Password Quality Check Plug-Ins

13.  Writing Computed Attribute Plug-Ins

Part II Directory Server Plug-In API Reference

14.  Data Type and Structure Reference

15.  Function Reference, Part I

16.  Function Reference, Part II

17.  Parameter Block Reference

A.  NameFinder Application

Prerequisite Software

Deploying NameFinder

Configuring NameFinder to Access Your Directory

Customizing NameFinder


Intercepting Information Sent to the Client

This section demonstrates functionality called by Directory Server before sending a result code, a referral, or an entry to the client application. Refer to install-path/examples/testpreop.c for the source code discussed here.

The following example shows the code that logs the operation number and user DN.

Example 5-24 Logging and Responding to the Client (testpreop.c)

#include "slapi-plugin.h"

testpreop_send(Slapi_PBlock * pb)
    Slapi_Operation * op;              /* Operation in progress   */
    char            * connDn;          /* Get DN from connection  */
    int               connId, opId, rc = 0;
    long              msgId;

    rc |= slapi_pblock_get(pb, SLAPI_OPERATION,       &op);
    rc |= slapi_pblock_get(pb, SLAPI_CONN_DN,         &connDn);
    rc |= slapi_pblock_get(pb, SLAPI_CONN_ID,         &connId);
    rc |= slapi_pblock_get(pb, SLAPI_OPERATION_MSGID, &msgId);
    rc |= slapi_pblock_get(pb, SLAPI_OPERATION_ID,    &opId);
    if (rc == 0) {
            "testpreop_send in test-preop plug-in",
            "Operation: %d\tUser: %s\n", slapi_op_get_type(op), connDn

    return (rc);

Operation identifiers are defined in the plug-in header file install-path/include/slapi-plugin.h. Search for SLAPI_OPERATION_*.

Before using the plug-in function as described here, set up the example suffix and register the plug-in. See Extending the Bind Operation and “To register the Plug-in”, as described previously.

With the plug-in activated in Directory Server, perform a search as Kirsten Vaughan:

$ ldapsearch -h localhost -p 1389 -b dc=example,dc=com \
 -D uid=kvaughan,ou=people,dc=example,dc=com -w bribery \

Search instance-path/logs/errors for the log messages. Minus housekeeping information, the first message reflects the bind result:

Operation: 1 User: uid=kvaughan,ou=people,dc=example,dc=com

The next message reflects the search:

Operation: 4 User: uid=kvaughan,ou=people,dc=example,dc=com

Inside plug-in functions, use slapi_op_get_type() to determine the type of an operation. Refer to Part II, Directory Server Plug-In API Reference for info about slapi_op_get_type(), or see the plug-in header file install-path/include/slapi-plugin.h for a list of operation types.