ldap_first_attribute()--Retrieve First Attribute in an Entry




Syntax

#include <ldap.h>
 
char *ldap_first_attribute(
		LDAP 		*ld,
                LDAPMessage 	*entry,
                BerElement 	**berptr)



Threadsafe: Yes

The ldap_first_attribute() function returns the first attribute in an entry.

ldap_first_attribute() takes an entry returned by ldap_first_entry() or ldap_next_entry() and returns a pointer to a buffer containing the first attribute type in the entry. This string must be freed when its use is completed using ldap_memfree().

The ldap_first_attribute() and ldap_next_attribute() functions are used to step through the attributes in an LDAP entry.

Authorities and Locks

No OS/400 authority is required. All authority checking is done by the LDAP server.

Parameters

ld
(Input) Specifies the LDAP pointer returned by a previous call to ldap_init(),ldap_ssl_init(), or ldap_open().

entry
(Input) The attribute information as returned by ldap_first_entry() or ldap_next_entry().

berptr
(Output) This is an output parameter returned from ldap_first_attribute(), which returns a pointer to a BerElement that has been allocated to keep track of current position. It is an input and output parameter for subsequent calls to ldap_next_attribute(), where it specifies a pointer to a BerElement which was allocated by the previous call to ldap_first_attribute(). The BerElement structure is opaque to the application.

Return Value

Pointer to a buffer containing the first attribute type in the entry
if the request was successful.
NULL
if the request was not successful.

Error Conditions

If ldap_first_attribute() is not successful, NULL is returned, ld_errno will be set to indicate the error and the memory pointed to by berptr is automatically freed and set to NULL. See LDAP Client API Error Conditions for possible LDAP error code values. Use ldap_get_errno() function to retrieve the error information.

Error Messages

    The following message may be set from this function.
    CPF3CF2 E  Error(s) occurred during running of ldap_first_attribute API.

Related Information

    ldap_count_attributes() -- count of the number of attributes in an LDAP entry.
    ldap_next_attribute() -- Return next attribute name in an entry. 


Top | LDAP APIs List
APIs by category

[Information Center Home Page | Feedback ] [Legal | AS/400 Glossary]