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 ); Parameter is as follows: ld The session handle. The ldap_unbind() and ldap_unbind_s() functions 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. The ldap_ unbind() function 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 and it is illegal to make any further LDAP API calls using ld.