HP-UX Directory Server 8.1 plug-in reference

Table Of Contents
Note:
Refer to the following source file for an example of a preoperation plug-in function that handles
authentication:
/opt/dirsrv/devel/example/testbind.c
8.5.1.1 Getting and checking the bind parameters
Call the “slapi_pblock_get()” function to get the values of the following parameters:
SLAPI_BIND_TARGET - A string value specifying the DN as which the client is attempting
to authenticate.
SLAPI_BIND_METHOD - An integer value specifying the authentication method, such as
LDAP_AUTH_SIMPLE or LDAP_AUTH_SASL.
SLAPI_BIND_CREDENTIALS - A berval structure containing the credentials sent by the
client.
If you plan to support authentication through SASL mechanisms, you should also get the value
of the SLAPI_BIND_SASLMECHANISM parameter (a string value specifying the name of the
SASL mechanism to use for authentication).
Ensure that you check the following:
Determine if the client is requesting to bind as an anonymous user.
If the SLAPI_BIND_METHOD parameter is LDAP_AUTH_SIMPLE and the
SLAPI_BIND_CREDENTIALS parameter is empty or NULL, the client is attempting to bind
anonymously.
Call “slapi_send_ldap_result()” to send the LDAP result code [LDAP_SUCCESS] back to
the client.
If the SLAPI_BIND_METHOD parameter specifies a method that you do not recognize or
support, call “slapi_send_ldap_result()” to send an
[LDAP_STRONG_AUTH_NOT_SUPPORTED] result code back to the client.
In both cases, return a nonzero value to prevent the server from calling the default back end
function for authentication.
8.5.1.2 Getting the entry and checking the credentials
Get the entry for the DN specified by the SLAPI_BIND_TARGET parameter, and compare the
credentials in the SLAPI_BIND_CREDENTIALS parameter against the known credentials for
that entry.
By default, Directory Server uses the userPassword attribute to store the credentials for an
entry. The server encodes the password using the scheme specified in the
nsslapd-rootpwstoragescheme or passwordStorageScheme attributes of the cn=config
entry contained in the dse.ldif file. The scheme can be any of the following:
CLEAR
No encryption is used, and can be defined using the clear-password-storage-scheme
plug-in.
CRYPT
The Unix Crypt Algorithm is used, and can be defined using the
crypt-password-storage-scheme plug-in.
8.5 Writing a preoperation bind plug-in 73