Platform SDK: Active Directory, ADSI, and Directory Services

ldap_unbind_s

The ldap_unbind_s function frees all resources associated with an LDAP session.

ULONG ldap_unbind_s(
  LDAP* ld 
);

Parameters

ld
[in] The session handle.

Return Values

If the function succeeds, the return value is LDAP_SUCCESS.

If the function fails, it returns an error code. See Return Values for more information.

Remarks

Call ldap_unbind_s to unbind from the directory, close the connection, and dispose of the session handle. Call this function whenever you have finished with a connection, even if you haven't called ldap_bind to open the connection. Make sure that you do not inadvertently call this function more than once on a session handle because doing so can free resources that you did not intend to release.

Both ldap_unbind and ldap_unbind_s work synchronously. There is no server response to an unbind operation.

Multithreading: Calls to ldap_unbind_s are safe except that you cannot use the session handle to the LDAP structure after it has been freed.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 SP4 or later.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in Winldap.h.
  Library: Use Wldap32.lib.

See Also

Functions, LDAP, ldap_bind, ldap_unbind, Return Values