This chapter explains how to write functions that the server calls before and after executing an LDAP operation. These functions are called pre-operation and post-operation plug-in functions.
How Pre/Post-Operation Plug-Ins Work
Writing Pre/Post-Operation Functions
Registering Pre/Post-Operation Functions
bind
unbind
search
modify
add
delete
modify RDN
compare
abandon
You can set up the Directory Server to call your own plug-in functions before and after executing these LDAP operations. For example, you can write a function that validates an entry before the server performs an LDAP add operation to add it to the directory. Or you can write a function that notifies a user whose entry has just been modified by an LDAP modify operation.
You can also set up the Directory Server to call your own plug-in functions before and after:
sending an LDAP entry back to the client
sending an LDAP result code back to the client
sending an LDAP referral back to the client
Figure 6.1 How the server calls pre-operation and post-operation plug-in functions
Types of Pre-Operation Functions
Table 6.1 lists the Directory Server pre-operation functions and the purpose of each function.
Table 6.1 Functions called before the Directory Server executes an operation
SLAPI_PLUGIN_PRE_BIND_FN
SLAPI_PLUGIN_PRE_UNBIND_FN
SLAPI_PLUGIN_PRE_SEARCH_FN
SLAPI_PLUGIN_PRE_COMPARE_FN
SLAPI_PLUGIN_PRE_ADD_FN
SLAPI_PLUGIN_PRE_MODIFY_FN
SLAPI_PLUGIN_PRE_MODRDN_FN
SLAPI_PLUGIN_PRE_DELETE_FN
SLAPI_PLUGIN_PRE_ABANDON_FN
SLAPI_PLUGIN_PRE_ENTRY_FN
SLAPI_PLUGIN_PRE_REFERRAL_FN
SLAPI_PLUGIN_PRE_RESULT_FN
Types of Post-Operation Functions
Table 6.2 lists the Directory Server post-operation functions and the purpose of each function.
Table 6.2 Functions called after the Directory Server executes an operation
SLAPI_PLUGIN_POST_BIND_FN
SLAPI_PLUGIN_POST_UNBIND_FN
SLAPI_PLUGIN_POST_SEARCH_FN
SLAPI_PLUGIN_POST_COMPARE_FN
SLAPI_PLUGIN_POST_ADD_FN
SLAPI_PLUGIN_POST_MODIFY_FN
SLAPI_PLUGIN_POST_MODRDN_FN
SLAPI_PLUGIN_POST_DELETE_FN
SLAPI_PLUGIN_POST_ABANDON_FN
SLAPI_PLUGIN_POST_ENTRY_FN
SLAPI_PLUGIN_POST_REFERRAL_FN
SLAPI_PLUGIN_POST_RESULT_FN
For details, follow the procedures outlined in "Writing an Initialization Function" on page 41 and "Configuring the Server" on page 46.
Note. Each pre-operation and post-operation plug-in is associated with a back-end. Make sure that the plugin directive that registers the plug-in is within the database section for that back-end in the server configuration file. (The plugin directive should be added somewhere after the database directive.)