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 a null-terminated string that contains the current attribute name. If there are no more attributes to step through, it returns NULL. The session error parameter in the LDAP data structure is set to 0 in either case.
If the function fails, it returns NULL and sets the session error parameter in the LDAP data structure to the LDAP error code.
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 track 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 ber_free (ptr, 0). Be aware that you must pass the second parameter as 0 (zero) in this call.
The ldap_next_attribute function returns a pointer to an internally allocated buffer that contains the current attribute name. Free this buffer, when no longer required, by calling ldap_memfree. Because this buffer is overwritten on the next call to either ldap_first_attribute or ldap_next_attribute, the user should make a copy of the attribute name if it must be preserved for processing.
Client: Included in Windows XP and
Windows 2000 Professional.
Server: Included in Windows Server 2003 and
Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension
on Windows NT 4.0 SP6a and Windows 95/98/Me.
Unicode: Implemented as Unicode and ANSI versions on all
platforms.
Header: Declared in Winldap.h.
Library: Use Wldap32.lib.
BerElement, Functions, ber_free, ldap_first_attribute, ldap_first_entry, ldap_get_values, ldap_memfree, ldap_next_entry, Searching a Directory