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


Preoperation and Postoperation Plug-Ins

When processing client requests and when sending information to clients, Directory Server calls preoperation and postoperation plug-in functions.

Preoperation Plug-Ins

Preoperation plug-ins are called before a client request is processed. Use preoperation plug-ins to validate attribute values, and to add to and delete from attributes that are provided in a request, for example.

Postoperation Plug-Ins

Postoperation plug-ins are called after a client request has been processed and all results have been sent to the client, whether or not the operation completes successfully. Use postoperation plug-ins to send alerts, or to send alarms. Also use postoperation plug-ins to perform auditing work, or to perform cleanup work.

Note - Directory Server calls preoperation and postoperation plug-ins only when an external client is involved. Internally, Directory Server also performs operations that no external client has requested.

To make this possible, Directory Server distinguishes between external operations and internal operations. External operations respond to incoming client requests. Internal operations are actions that are performed without a corresponding client request.

Several operations support the use of preoperation and postoperation plug-in functions. Operations include abandon, add, bind, compare, delete, modify, modify RDN, search, send entry, send referral, send result, and unbind. The plug-ins function regardless of the Directory Server front end contacted by the client application.

As is the case for other plug-in functions, slapi_pblock_set() is used in the plug-in initialization function to register preoperation and postoperation plug-in functions. slapi_pblock_set() is described in Part II, Directory Server Plug-In API Reference.

Registration Identifiers

Preoperation plug-in registrations use IDs of the form SLAPI_PLUGIN_PRE_operation_FN. Postoperation registrations use IDs of the form SLAPI_PLUGIN_POST_operation_FN. Here, operation is one of ABANDON, ADD, BIND, COMPARE, DELETE, ENTRY (sending entries to the client), MODIFY, MODRDN, REFERRAL (sending referrals to the client), RESULT (sending results to the client), SEARCH, or UNBIND.

Note - Preoperation and postoperation plug-ins can also register functions to run at Directory Server startup, using SLAPI_PLUGIN_START_FN, and at Directory Server shutdown, using SLAPI_PLUGIN_STOP_FN.

Part II, Directory Server Plug-In API Reference describes these IDs. Refer also to install-path/include/slapi-plugin.h for the complete list of IDs used at build time.

The following example demonstrates how the functions are registered with Directory Server by using the appropriate registration IDs.

Example 5-1 Registering Postoperation Functions (testpostop.c)

#include "slapi-plugin.h"

Slapi_PluginDesc postop_desc = {
    "test-postop",                     /* plug-in identifier         */
    "Oracle Corporation (test)",       /* vendor name                */
    "",                      /* plug-in revision number    */
    "Sample post-operation plug-in"    /* plug-in description        */

static Slapi_ComponentId * postop_id;  /* Used to set log            */

/* Register the plug-in with the server. */
#ifdef _WIN32
testpostop_init(Slapi_PBlock * pb)
    int rc = 0;                        /* 0 means success            */
    rc |= slapi_pblock_set(            /* Plug-in API version        */
    rc |= slapi_pblock_set(            /* Plug-in description        */
        (void *) &postop_desc
    rc |= slapi_pblock_set(            /* Open log at startup        */
        (void *) testpostop_set_log
    rc |= slapi_pblock_set(            /* Post-op add function       */
        (void *) testpostop_add
    rc |= slapi_pblock_set(            /* Post-op modify function    */
        (void *) testpostop_mod
    rc |= slapi_pblock_set(            /* Post-op delete function    */
        (void *) testpostop_del
    rc |= slapi_pblock_set(            /* Post-op modrdn function    */
        (void *) testpostop_modrdn
    rc |= slapi_pblock_set(            /* Close log on shutdown      */
        (void *) testpostop_free_log
    /* Plug-in identifier is required for internal search.           */
    rc |= slapi_pblock_get(pb, SLAPI_PLUGIN_IDENTITY, &postop_id);
    return (rc);

In addition to its postoperation functions, the plug-in that is shown in the preceding example registers a function. The plug-in opens a log file at startup. The plug-in closes the log file at shutdown. For details, refer to install-path/examples/testpostop.c.

Location of Plug-In Examples

Plug-in examples are located in install-path/examples/.