]> git.sur5r.net Git - openldap/blob - doc/man/man3/ldap_search.3
improve timeout support (ITS#4157, ITS#4663); manpage cleanup
[openldap] / doc / man / man3 / ldap_search.3
1 .TH LDAP_SEARCH 3 "RELEASEDATE" "OpenLDAP LDVERSION"
2 .\" $OpenLDAP$
3 .\" Copyright 1998-2006 The OpenLDAP Foundation All Rights Reserved.
4 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
5 .SH NAME
6 ldap_search, ldap_search_s, ldap_search_st, ldap_search_ext, ldap_search_ext_s \- Perform an LDAP search operation
7 .SH LIBRARY
8 OpenLDAP LDAP (libldap, -lldap)
9 .SH SYNOPSIS
10 .nf
11 .ft B
12 #include <sys/types.h>
13 #include <ldap.h>
14 .LP
15 .ft B
16 int ldap_search_ext(
17 .RS
18 LDAP *\fIld\fB,
19 char *\fIbase\fB,
20 int \fIscope\fB,
21 char *\fIfilter\fB,
22 char *\fIattrs\fB[],
23 int \fIattrsonly\fB,
24 LDAPControl **\fIserverctrls\fB,
25 LDAPControl **\fIclientctrls\fB,
26 struct timeval *\fItimeout\fB,
27 int sizelimit, *\fImsgidp\fB );
28 .RE
29 .LP
30 .ft B
31 int ldap_search_ext_s(
32 .RS
33 LDAP *\fIld\fB,
34 char *\fIbase\fB,
35 int \fIscope\fB,
36 char *\fIfilter\fB,
37 char *\fIattrs\fB[],
38 int \fIattrsonly\fB,
39 LDAPControl **\fIserverctrls\fB,
40 LDAPControl **\fIclientctrls\fB,
41 struct timeval *\fItimeout\fB,
42 LDAPMessage **\fIres\fB );
43 .RE
44 .SH DESCRIPTION
45 These routines are used to perform LDAP search operations.
46 The
47 .B ldap_search_ext_s()
48 routine
49 does the search synchronously (i.e., not
50 returning until the operation completes), providing a pointer
51 to the resulting LDAP messages at the location pointed to by
52 the \fIres\fP parameter.
53 .LP
54 The
55 .B ldap_search_ext()
56 routine is the asynchronous version, initiating the search and returning
57 the message id of the operation it initiated in the integer
58 pointed to by the \fImsgidp\fP parameter.
59 .LP
60 The \fIbase\fP parameter is the DN of the entry at which to start the search.
61 .LP
62 The \fIscope\fP parameter is the scope of the search and should be one
63 of LDAP_SCOPE_BASE, to search the object itself, LDAP_SCOPE_ONELEVEL,
64 to search the object's immediate children, LDAP_SCOPE_SUBTREE, to
65 search the object and all its descendants, or LDAP_SCOPE_CHILDREN,
66 to search all of the descendants.   Note that the latter requires
67 the server support the LDAP Subordinates Search Scope extension.
68 .LP
69 The \fIfilter\fP is a string representation of the filter to
70 apply in the search.  The string should conform to the format
71 specified in RFC 4515 as extended by RFC 4526.  For instance,
72 "(cn=Jane Doe)".  Note that use of the extension requires the
73 server to support the LDAP Absolute True/False Filter extension.
74 NULL may be specified to indicate the library should send the
75 filter (objectClass=*).
76 .LP
77 The \fIattrs\fP parameter is a null-terminated array of attribute
78 descriptions to return from matching entries.
79 If NULL is specified, the return of all user attributes is requested.
80 The description "*" (LDAP_ALL_USER_ATTRIBUTES) may be used to request
81 all user attributes to be returned.
82 The description "+"(LDAP_ALL_OPERATIONAL_ATTRIBUTES) may be used to
83 request all operational attributes to be returned.  Note that this
84 requires the server to suppor the LDAP All Operational Attribute
85 extension.
86 To request no attributes, the description "1.1" (LDAP_NO_ATTRS)
87 should be listed by itself.
88 .LP
89 The \fIattrsonly\fP parameter should be set to a non-zero value
90 if only attribute descriptions are wanted.  It should be set to zero (0)
91 if both attributes descriptions and attribute values are wanted.
92 .LP
93 The \fIserverctrls\fP and \fIclientctrls\fP parameters may be used
94 to specify server and client controls, respectively.
95 .LP
96 The
97 .B ldap_search_ext_s()
98 routine is the synchronous version of
99 .BR ldap_search_ext().
100 .LP
101 It also returns a code indicating success or, in the
102 case of failure, indicating the nature of the failure
103 of the operation.  See
104 .BR ldap_error (3)
105 for details.
106 .SH NOTES
107 Note that both read
108 and list functionality are subsumed by these routines,
109 by using a filter like "(objectclass=*)" and a scope of LDAP_SCOPE_BASE (to
110 emulate read) or LDAP_SCOPE_ONELEVEL (to emulate list).
111 .LP
112 These routines may dynamically allocate memory. The caller is
113 responsible for freeing such memory using supplied deallocation
114 routines. Return values are contained in <ldap.h>.
115 .SH DEPRECATED INTERFACES
116 The 
117 .B ldap_search()
118 routine is deprecated in favor of the
119 .B ldap_search_ext()
120 routine.  The 
121 .B ldap_search_s()
122 and
123 .B ldap_search_st()
124 routines are deprecated in favor of the
125 .B ldap_search_ext_s()
126 routine.
127 .LP
128 .so Deprecated
129 .SH SEE ALSO
130 .BR ldap (3),
131 .BR ldap_result (3),
132 .BR ldap_error (3)
133 .SH ACKNOWLEDGEMENTS
134 .so ../Project