Platform SDK: Active Directory, ADSI, and Directory Services

ldap_first_reference

The ldap_first_reference function returns the first reference from a message.

LDAPMessage* ldap_first_reference(
  LDAP* ld,
  LDAPMessage* res
);

Parameters

ld
[in] The session handle.
res
[in] The search result, as obtained by a call to one of the synchronous search routines or ldap_result.

Return Values

If the function succeeds, it returns the reference. If no reference exists in the result set, it returns NULL.

If the function fails, it returns NULL and sets the session error parameters in the LDAP data structure.

Remarks

Use ldap_first_reference in conjunction with ldap_next_reference to step through and retrieve a list of continuation references from a search result chain.

The function returns subordinate referrals (references) that are returned in search responses. A subordinate referral is one in which the server has returned some data and the referral has been passed to other naming contexts below the current level in the tree. To step through external references in which the naming context doesn't reside on the server, use ldap_parse_result instead.

You do not have to explicitly free the returned reference as it is freed when the message itself is 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_next_reference, ldap_parse_result, ldap_result