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