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