]> git.sur5r.net Git - openldap/blob - doc/man/man3/ldap_first_attribute.3
Merge remote-tracking branch 'origin/mdb.RE/0.9' into OPENLDAP_REL_ENG_2_4
[openldap] / doc / man / man3 / ldap_first_attribute.3
1 .TH LDAP_FIRST_ATTRIBUTE 3 "RELEASEDATE" "OpenLDAP LDVERSION"
2 .\" $OpenLDAP$
3 .\" Copyright 1998-2015 The OpenLDAP Foundation All Rights Reserved.
4 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
5 .SH NAME
6 ldap_first_attribute, ldap_next_attribute \- step through LDAP entry attributes
7 .SH LIBRARY
8 OpenLDAP LDAP (libldap, \-lldap)
9 .SH SYNOPSIS
10 .nf
11 .ft B
12 #include <ldap.h>
13 .LP
14 .ft B
15 char *ldap_first_attribute(
16         LDAP *ld, LDAPMessage *entry, BerElement **berptr )
17 .LP
18 .ft B
19 char *ldap_next_attribute(
20         LDAP *ld, LDAPMessage *entry, BerElement *ber )
21 .SH DESCRIPTION
22 The
23 .B ldap_first_attribute()
24 and
25 .B ldap_next_attribute()
26 routines are used
27 to step through the attributes in an LDAP entry.
28 .B ldap_first_attribute()
29 takes an \fIentry\fP as returned by
30 .BR ldap_first_entry (3)
31 or
32 .BR ldap_next_entry (3)
33 and returns a pointer to character string
34 containing the first attribute description in the entry.
35 .B ldap_next_attribute()
36 returns the next attribute description in the entry.
37 .LP
38 It also returns, in \fIberptr\fP, a pointer to a BerElement it has
39 allocated to keep track of its current position.  This pointer should
40 be passed to subsequent calls to
41 .B ldap_next_attribute()
42 and is used
43 to effectively step through the entry's attributes.  The caller is
44 solely responsible for freeing the BerElement pointed to by \fIberptr\fP
45 when it is no longer needed by calling
46 .BR ber_free (3).
47 When calling
48 .BR ber_free (3)
49 in this instance, be sure the second argument is 0.
50 .LP
51 The attribute names returned are suitable for inclusion in a call
52 to
53 .BR ldap_get_values (3)
54 to retrieve the attribute's values.
55 .SH ERRORS
56 If an error occurs, NULL is returned and the ld_errno field in the
57 \fIld\fP parameter is set to indicate the error.  See
58 .BR ldap_error (3)
59 for a description of possible error codes.
60 .SH NOTES
61 The
62 .B ldap_first_attribute()
63 and
64 .B ldap_next_attribute()
65 return dynamically allocated memory that must be freed by the caller via
66 .BR ldap_memfree (3).   
67 .SH SEE ALSO
68 .BR ldap (3),
69 .BR ldap_first_entry (3),
70 .BR ldap_get_values (3),
71 .BR ldap_error (3)
72 .SH ACKNOWLEDGEMENTS
73 .so ../Project