Platform SDK: Active Directory, ADSI, and Directory Services |
For a given entry, the ldap_next_attribute function returns the next attribute.
PCHAR ldap_next_attribute( LDAP* ld, LDAPMessage* entry, BerElement* ptr );
If the function succeeds, it returns a pointer to an allocated buffer containing the current attribute name. If there are no more attributes to step through, it returns NULL.
If the function fails, it returns NULL and sets the session error parameters in the LDAP data structure.
Use ldap_next_attribute in conjunction with ldap_first_attribute to step through the list of attribute types returned with an entry. You can then pass these attribute names in a call to ldap_get_values to retrieve their associated values.
A call to ldap_next_attribute returns, through the ptr parameter, a pointer to a BerElement structure. Pass this pointer to the next call to ldap_next_attribute to keep track of the current position in the list of attributes. When you have finished stepping through a list of attributes, and ptr is non-NULL, free the pointer by calling ldap_ber_free (ptr, 0). Note that it is very important to pass the second parameter as 0 (zero) in this call.
The ldap_next_attribute function returns a pointer to an allocated buffer containing the current attribute name. This should be freed when no longer in use by calling ldap_memfree.
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.
Unicode: Declared as Unicode and ANSI prototypes.
BerElement, Functions, ldap_ber_free, ldap_first_attribute, ldap_first_entry, ldap_get_values, ldap_memfree, ldap_next_entry.