|
VMS Help LDAP, Search Results, Stepping Through the Attributes of an Entry *Conan The Librarian |
The ldap_first_attribute() and ldap_next_attribute() calls are
used to step through the list of attribute types returned with an
entry.
char *ldap_first_attribute(
LDAP *ld,
LDAPMessage *entry,
BerElement **ptr
);
char *ldap_next_attribute(
LDAP *ld,
LDAPMessage *entry,
BerElement *ptr
);
void ldap_memfree( char *mem );
Parameters are as follows:
ld The session handle.
entry The entry whose attributes are to be stepped through, as
returned by ldap_first_entry() or ldap_next_entry().
ptr In ldap_first_attribute(), the address of a pointer used
internally to keep track of the current position in the
entry. In ldap_next_attribute(), the pointer returned by a
previous call to ldap_first_attribute().
mem A pointer to memory allocated by the LDAP library, such
as the attribute type names returned by ldap_first_
attribute() and ldap_next_attribute(), or the DN returned
by ldap_get_dn().
The ldap_first_attribute() and ldap_next_attribute() functions
will return NULL when the end of the attributes is reached, or
if there is an error, in which case the error parameters in the
session handle ld will be set to indicate the error.
Both functions return a pointer to an allocated buffer containing
the current attribute name. This should be freed when no longer
in use by calling ldap_memfree().
The ldap_first_attribute() function will allocate and return in
ptr a pointer to a BerElement used to keep track of the current
position. This pointer should be passed in subsequent calls to
ldap_next_attribute() to step through the entry's attributes.
After a set of calls to ldap_first_attribute() and ldap_next_
attribute(), if ptr is non-NULL, it should be freed by calling
ber_free(ptr, 0). Note that it is very important to pass the
second parameter as 0 (zero) in this call, since the buffer
associated with the BerElement does not point to separately
allocated memory.
The attribute type names returned are suitable for passing in a
call to ldap_get_values() to retrieve the associated values.
|
|