|
||
|
|
Chapter 6 Writing Pre/Post-Operation Plug-Ins
This chapter explains how to write functions that the Netscape Directory Server (Directory 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
![]()
- Types Pre-Operation and Post-Operation Functions
![]()
- Registering Pre/Post-Operation Functions
![]()
How Pre/Post-Operation Plug-Ins Work
The Directory Server can perform the following LDAP operations: Bind, Unbind, Search, Modify, Add, Delete, Modify RDN, Compare, and Abandon.
The Directory Server can also perform extended operations as defined in the LDAP v3 protocol. For information on implementing plug-in functions to execute extended operations, see Chapter 10 "Writing Extended Operation Plug-Ins".
You can configure the Directory Server to call your custom plug-in functions before and after executing any of these LDAP operations.
For example, you can write a pre-operation function that validates an entry before the server performs an LDAP add operation. An example of a post-operation plug-in function would be one that sends a notification to a user after their entry has 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 illustrates how the Directory Server front-end calls pre-operation and post-operation functions before and after executing an LDAP operation.
When processing a request, the Directory Server will call all registered pre-operation functions before it calls the back-end to service the request. All pre-operation functions must return before the front-end calls the associated back-end function.
Figure 6-1 Calling Pre-Operation and Post-Operation Plug-In Functions
![]()
Types Pre-Operation and Post-Operation Functions
As is the case with other server plug-in functions, pre-operation functions and post-operation functions are specified in a parameter block that you can set on server startup. Each function corresponds to an ID in the parameter block. In your initialization function, you can call the
slapi_pblock_set()function to specify the name of your function that corresponds to the pre-operation or post-operation function. For more information on the parameter block, see Getting Data from the Parameter Block.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
Specifies the function called before the Directory Server executes an LDAP bind operation. For information on writing this type of function, see Processing an LDAP Bind Operation.
Specifies the function called before the Directory Server executes an LDAP unbind operation. For information on writing this type of function, see Processing an LDAP Unbind Operation.
Specifies the function called before the Directory Server executes an LDAP search operation. For information on writing this type of function, see Processing an LDAP Search Operation.
Specifies the function called before the Directory Server executes an LDAP compare operation. For information on writing this type of function, see Processing an LDAP Compare Operation.
Specifies the function called before the Directory Server executes an LDAP add operation. For information on writing this type of function, see Processing an LDAP Add Operation.
Specifies the function called before the Directory Server executes an LDAP modify operation. For information on writing this type of function, see Processing an LDAP Modify Operation.
Specifies the function called before the Directory Server executes an LDAP modify RDN operation. For information on writing this type of function, see Processing an LDAP Modify RDN Operation.
Specifies the function called before the Directory Server executes an LDAP delete operation. For information on writing this type of function, see Processing an LDAP Delete Operation.
Specifies the function called before the Directory Server executes an LDAP abandon operation. For information on writing this type of function, see Processing an LDAP Abandon Operation.
Specifies the function called before the Directory Server sends an entry back to the client (for example, when you call
slapi_send_ldap_search_entry(), the pre-operation entry function is called before the entry is sent back to the client).Specifies the function called before the Directory Server sends a referral back to the client (for example, when you call
slapi_str2filter(), the pre-operation referral function is called before the referral is sent back to the client).Specifies the function called before the Directory Server sends a result code back to the client (for example, when you call
slapi_send_ldap_result(), the pre-operation result function is called before the result code is sent back to the client).
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
Specifies the function called after the Directory Server executes an LDAP bind operation. For information on writing this type of function, see Processing an LDAP Bind Operation.
Specifies the function called after the Directory Server executes an LDAP unbind operation. For information on writing this type of function, see Processing an LDAP Unbind Operation.
Specifies the function called after the Directory Server executes an LDAP search operation. For information on writing this type of function, see Processing an LDAP Search Operation.
Specifies the function called after the Directory Server executes an LDAP compare operation. For information on writing this type of function, see Processing an LDAP Compare Operation.
Specifies the function called after the Directory Server executes an LDAP add operation. For information on writing this type of function, see Processing an LDAP Add Operation.
Specifies the function called after the Directory Server executes an LDAP modify operation. For information on writing this type of function, see Processing an LDAP Modify Operation.
Specifies the function called after the Directory Server executes an LDAP modify RDN operation. For information on writing this type of function, see Processing an LDAP Modify RDN Operation.
Specifies the function called after the Directory Server executes an LDAP delete operation. For information on writing this type of function, see Processing an LDAP Delete Operation.
Specifies the function called after the Directory Server executes an LDAP abandon operation. For information on writing this type of function, see Processing an LDAP Abandon Operation.
Specifies the function called after the Directory Server sends an entry back to the client (for example, when you call
slapi_send_ldap_search_entry(), the post-operation entry function is called after the entry is sent back to the client).Specifies the function called after the Directory Server sends a referral back to the client (for example, when you call
slapi_str2filter(), the pre-operation referral function is called after the referral is sent back to the client).Specifies the function called after the Directory Server sends a result code back to the client (for example, when you call
slapi_send_ldap_result(), the pre-operation result function is called after the result code is sent back to the client).
Registering Pre/Post-Operation Functions
To register your pre-operation and post-operation plug-in functions, you need to write an initialization function and then configure the server to load your plug-in. For details, follow the procedures outlined in Writing Plug-in Initialization Functions and Configuring Plug-Ins.
© 2001 Sun Microsystems, Inc. Portions copyright 1999, 2002-2003 Netscape Communications Corporation. All rights reserved.
Read the Full Copyright and Thrid-Party Acknowledgments.
Last Updated October 30, 2003