ldap_next_attribute

Returns the name of the next attribute in an entry.

LDAP Version:v2 or higher
Library:*ldapsdk.*
NDS Version:7.xx or higher
Platform:NLM, Windows (NT, 95, 98, 2000, XP, Vista 32-bit and 64-bit ), Linux (32-bit and 64-bit), Solaris, AIX, and HP-UX

Syntax

  #include <ldap.h>
  
  char *ldap_next_attribute (
     LDAP          *ld,
     LDAPMessage   *entry,
     BerElement    *ptr);
  
  

Parameters

ld

(IN) Points to the handle for the LDAP session.

entry

(IN) Points to the entry whose attributes are being read.

ptr

(IN/OUT) Points to a value used internally to track the current position in the entry. For the first call, use the value returned by the ldap_first_attribute function. In subsequent calls, use the value returned by the previous ldap_next_attribute call. When the application is done with the ptr, it should free the BerElement by calling the ber_free (ptr, 0) function.

Return Values

NULL

No more attributes or failure

>0

Pointer to the name of the next attribute

Remarks

The ldap_next_attribute function returns a pointer to the next attribute of an entry returned by either the ldap_first_entry or the ldap_next_entry function.

If NULL is returned and the ptr parameter is not NULL, check the LDAP_OPT_RESULT_CODE option in the LDAP handle for the error code.

If NULL is returned and the ptr parameter is NULL, all attributes have been retrieved.

The pointer to the name of the attribute should be passed to the ldap_get_values function (or others of its type) to retrieve the attribute's values. When you are done with this pointer, you must free it by calling the ldap_memfree function.

The ptr parameter should be used in subsequent calls to the ldap_next_attribute function to retrieve other attributes of the entry. When you are done with the BerElement structure and its value is non-NULL, you must free it by calling the ber_free function with the second parameter set to 0. If the ptr parameter is set to NULL, then the ldap_next_attribute function frees the memory.

See Also

ldap_first_attribute, ldap_get_values