ldap_unbind_s function (winldap.h)

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

Syntax

WINLDAPAPI ULONG LDAPAPI ldap_unbind_s(
  [in] LDAP *ld
);

Parameters

[in] ld

The session handle.

Return value

If the function succeeds, the return value is LDAP_SUCCESS.

If the function fails, it returns an error code. For more information, see Return Values.

Remarks

Call ldap_unbind_s to unbind from the directory, close the connection, and dispose of the session handle. Call this function when the LDAP connection structure is no longer required, even if you have not called ldap_bind when opening the connection. Ensure 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

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header winldap.h
Library Wldap32.lib
DLL Wldap32.dll

See also

Functions

LDAP

Return Values

ldap_bind

ldap_unbind