Show Table of Contents
Chapter 7. Defining Functions for LDAP Operations
This chapter explains how to write pre-operation and post-operation functions for specific LDAP operations. In general, the functions outlined here use a parameter block to pass information between the plug-in and the Red Hat Directory Server. Because of this, these plug-in functions will pass a single argument, a parameter block defined by the data type Slapi_PBlock. Refer to Section 2.1.2, “Passing Data with Parameter Blocks” for more information.
7.1. Specifying Start and Close Functions
For each pre-operation and post-operation plug-in, you can specify a function to be called after the server starts and before the server is shut down.
For example, the plug-in may need some context information to pass to all of the plug-in callback functions. Then, create the context in the start function and store it in the
SLAPI_PLUGIN_PRIVATE slot to use throughout the plug-in. Any resources (free()) and any memory allocated in the start function must be released in the close function.
Another example is if the plug-in needs to communicate with an external database. The connection is usually opened in the start function, and the connection must be closed in the close function.
In the plug-in init function, use the following parameters with slapi_pblock_set() to specify these functions:
| SLAPI_PLUGIN_START_FN | Specifies the function called after the Directory Server starts. |
| SLAPI_PLUGIN_CLOSE_FN | Specifies the function called before the Directory Server shuts down. |

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.