]> git.sur5r.net Git - openldap/blob - doc/man/man3/ldap_first_attribute.3
Update ldap_first_attribute/ldap_next_attribute to handle
[openldap] / doc / man / man3 / ldap_first_attribute.3
1 .TH LDAP_FIRST_ATTRIBUTE 3 "22 September 1998" "OpenLDAP LDVERSION"
2 .SH NAME
3 ldap_first_attribute, ldap_next_attribute \- step through LDAP entry attributes
4 .SH SYNOPSIS
5 .nf
6 .ft B
7 #include <lber.h>
8 #include <ldap.h>
9 .LP
10 .ft B
11 char *ldap_first_attribute(ld, entry, berptr)
12 .ft
13 LDAP *ld;
14 LDAPMessage *entry;
15 BerElement **berptr;
16 .LP
17 .ft B
18 char *ldap_next_attribute(ld, entry, ber)
19 .ft
20 LDAP *ld;
21 LDAPMessage *entry;
22 BerElement *ber;
23 .SH DESCRIPTION
24 The
25 .B ldap_first_attribute()
26 and
27 .B ldap_next_attribute()
28 routines are used
29 to step through the attributes in an LDAP entry.
30 .B ldap_first_attribute()
31 takes an \fIentry\fP as returned by
32 .BR ldap_first_entry (3)
33 or
34 .BR ldap_next_entry (3)
35 and returns a pointer to a per-connection buffer
36 containing the first attribute type in the entry.  The return value
37 should be treated as if it is a pointer to a static area (i.e.,
38 .BR strdup (3)
39 it if you want to save it).
40 .LP
41 It also returns, in \fIberptr\fP, a pointer to a BerElement it has
42 allocated to keep track of its current position.  This pointer should
43 be passed to subsequent calls to
44 .B ldap_next_attribute()
45 and is used used
46 to effectively step through the entry's attributes.  The caller is
47 solely responsible for freeing the BerElement pointed to by \fIberptr\fP
48 when it is no longer needed by calling
49 .BR ber_free (3).
50 When calling
51 .BR ber_free (3)
52 in this instance, be sure the second argument is 0.
53 .LP
54 The attribute names returned are suitable for inclusion in a call
55 to
56 .BR ldap_get_values (3)
57 to retrieve the attribute's values.
58 .SH ERRORS
59 If an error occurs, NULL is returned and the ld_errno field in the
60 \fIld\fP parameter is set to indicate the error.  See
61 .BR ldap_error (3)
62 for a description of possible error codes.
63 .SH NOTES
64 The
65 .B ldap_first_attribute()
66 routine dyanamically allocated memory that must be freed by the caller via
67 .BR ber_free (3).   
68 .SH SEE ALSO
69 .BR ldap(3),
70 .BR ldap_first_entry(3),
71 .BR ldap_get_values(3),
72 .BR ldap_error(3)
73 .SH ACKNOWLEDGEMENTS
74 .B      OpenLDAP
75 is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
76 .B      OpenLDAP
77 is derived from University of Michigan LDAP 3.3 Release.