Up to Contents

Back to Authenticating to the Directory

Closing the session

The following functions are used to unbind from the directory, close the connection, and dispose of the session handle.

           int ldap_unbind( LDAP *ld );

           int ldap_unbind_s( LDAP *ld );

Parameters are:

ld
The session handle.

ldap_unbind() and ldap_unbind_s() both work synchronously, unbinding from the directory, closing the connection, and freeing up the ld structure before returning. There is no server response to an unbind operation. ldap_unbind() returns LDAP_SUCCESS (or another LDAP error code if the request cannot be sent to the LDAP server). After a call to ldap_unbind() or ldap_unbind_s(), the session handle ld is invalid.

Up to Contents

Forward to Searching