HP-UX Directory Server 8.1 plug-in reference

Table Of Contents
7 Defining functions for LDAP operations
This chapter explains how to write preoperation and postoperation functions for specific LDAP
operations. In general, the functions outlined here use a parameter block to pass information
between the plug-in and the HP-UX 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
“Passing data with parameter blocks” for more information.
7.1 Specifying start and close functions
For each preoperation and postoperation plug-in, you can specify a function to be called after
the server starts and before the server is shut down.
In the plug-in init function, use the following parameters with “slapi_pblock_set()” to specify
these functions:
Specifies the function called after the Directory Server starts.
SLAPI_PLUGIN_START_FN
Specifies the function called before the Directory Server shuts down.
SLAPI_PLUGIN_CLOSE_FN
7.2 Processing an LDAP bind operation
When the Directory Server receives an LDAP bind request from a client, the front end determines
the DN the client is attempting to bind and the authentication method being used. The front end
also gets the credentials used for authentication and, if SASL is used for authentication, the SASL
mechanism used.
7.2.1 Defining functions for the bind operation
In the parameter block, the following parameters specify plug-in functions that are called in the
process of executing a bind operation:
The SLAPI_PLUGIN_PRE_BIND_FN parameter specifies the preoperation bind function.
The SLAPI_PLUGIN_POST_BIND_FN parameter specifies the postoperation bind function.
To register the plug-in functions, call “slapi_pblock_set()” to set these parameters in your
initialization function. Refer to “Registering your plug-in functions”.
Your preoperation and postoperation bind functions should return 0 if successful. If the
preoperation function returns a nonzero value, the postoperation bind function is never called.
For information on defining a function that handles authentication, refer to Chapter 8 “Defining
functions for authentication”.
7.2.2 Getting and setting parameters for the bind operation
The front end makes this information available to preoperation and postoperation plug-in
functions in the form of parameters in a parameter block.
Table 7-1 Parameters for the bind operation
DescriptionData typeParameter ID
DN of the entry as which to bind.
char *SLAPI_BIND_TARGET
Authentication method used; for
example, LDAP_AUTH_SIMPLE or
LDAP_AUTH_SASL.
intSLAPI_BIND_METHOD
Credentials from the bind request.
struct berval *SLAPI_BIND_CREDENTIALS
7.1 Specifying start and close functions 61