ldap_conn_from_msg function (winldap.h)

The ldap_conn_from_msg function returns the LDAP session handle (connection pointer) for a particular message.

Syntax

WINLDAPAPI LDAP *LDAPAPI ldap_conn_from_msg(
  [in] LDAP        *PrimaryConn,
  [in] LDAPMessage *res
);

Parameters

[in] PrimaryConn

A pointer to the LDAP session handle of the message, if known. If the LDAP session handle for the message is unknown, then NULL may be passed for this parameter provided that the LDAP_OPT_REF_DEREF_CONN_PER_MSG session option had been previously set for the message session.

[in] res

The LDAP message queried. If NULL is passed for this parameter, then the function will respond with a NULL return value.

Return value

The return value is the LDAP session handle (connection pointer) where the message originated from. This function returns NULL if the originating session has closed or if a NULL LDAPMessage pointer is passed to the function and the LDAP_OPT_REF_DEREF_CONN_PER_MSG session option was not previously set for the message session.

Remarks

This function is used to identify the LDAP session handle associated with the specified LDAP message. It returns a valid LDAP session handle only if one of the following conditions are met:

If neither of these conditions are met, the function returns a NULL session handle.

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

Establishing an LDAP Session

Functions

LDAP

LDAPMessage

Return Values

ldap_init

ldap_set_option

structures