1 .TH LDAP_OPEN 3 "RELEASEDATE" "OpenLDAP LDVERSION"
3 .\" Copyright 1998-2018 The OpenLDAP Foundation All Rights Reserved.
4 .\" Copying restrictions apply. See COPYRIGHT/LICENSE.
6 ldap_init, ldap_initialize, ldap_open \- Initialize the LDAP library and open a connection to an LDAP server
8 OpenLDAP LDAP (libldap, \-lldap)
15 LDAP *ldap_open(host, port)
21 LDAP *ldap_init(host, port)
27 int ldap_initialize(ldp, uri)
38 int ldap_set_urllist_proc(ld, proc, params)
41 LDAP_URLLIST_PROC *proc;
45 int (LDAP_URLLIST_PROC)(ld, urllist, url, params);
48 LDAPURLDesc **urllist;
56 int ldap_init_fd(fd, proto, uri, ldp)
65 opens a connection to an LDAP server and allocates an LDAP
66 structure which is used to identify
67 the connection and to maintain per-connection information.
69 allocates an LDAP structure but does not open an initial connection.
71 allocates an LDAP structure but does not open an initial connection.
73 allocates an LDAP structure using an existing connection on the
76 of these routines must be called before any operations are attempted.
79 takes \fIhost\fP, the hostname on which the LDAP server is
80 running, and \fIport\fP, the port number to which to connect. If the default
81 IANA-assigned port of 389 is desired, LDAP_PORT should be specified for
82 \fIport\fP. The \fIhost\fP parameter may contain a blank-separated list
83 of hosts to try to connect to, and each host may optionally by of the form
84 \fIhost:port\fP. If present, the \fI:port\fP overrides the \fIport\fP
87 Upon successfully making a connection to an
90 returns a pointer to an opaque LDAP structure, which should be passed
91 to subsequent calls to
94 etc. Certain fields in the LDAP structure can be set to indicate size limit,
95 time limit, and how aliases are handled during operations; read and write access
96 to those fields must occur by calling
97 .BR ldap_get_option (3)
99 .BR ldap_set_option (3)
100 respectively, whenever possible.
106 but does not open a connection
107 to the LDAP server. The actual connection open will occur when the
108 first operation is attempted.
113 but it returns an integer indicating either success or the failure reason,
114 and it allows to specify details for the connection in the schema portion
118 parameter may be a comma- or whitespace-separated list of URIs
128 other (non-standard) recognized values of the
137 (connectionless LDAP).
138 If other fields are present, the behavior is undefined.
144 are deprecated in favor of
145 .BR ldap_initialize() ,
146 essentially because the latter allows to specify a schema in the URI
147 and it explicitly returns an error code.
150 causes a handle created by
152 to connect to the server. This is useful in situations where a file
153 descriptor is required before a request is performed.
156 allows an LDAP structure to be initialized using an already-opened
159 parameter should be one of LDAP_PROTO_TCP, LDAP_PROTO_UDP,
161 for a connection using TCP, UDP, or IPC, respectively. The value
163 may also be specified if user-supplied sockbuf handlers are going to
164 be used. Note that support for UDP is not implemented unless libldap
165 was built with LDAP_CONNECTIONLESS defined.
168 parameter may optionally be provided for informational purposes.
170 .B ldap_set_urllist_proc()
171 allows to set a function
175 that is called when a successful connection can be established.
176 This function receives the list of URIs parsed from the
178 string originally passed to
179 .BR ldap_initialize() ,
180 and the one that successfully connected.
181 The function may manipulate the URI list; the typical use consists
182 in moving the successful URI to the head of the list,
183 so that subsequent attempts to connect to one of the URIs using the same LDAP handle
189 is set as a global parameter that is inherited by all handlers
190 within the process that are created after the call to
191 .BR ldap_set_urllist_proc() .
195 In a multithreaded environment,
196 .B ldap_set_urllist_proc()
197 must be called before any concurrent operation using the LDAP handle is started.
199 Note: the first call into the LDAP library also initializes the global
200 options for the library. As such the first call should be single-threaded
201 or otherwise protected to insure that only one call is active. It is
203 .BR ldap_get_option ()
205 .BR ldap_set_option ()
206 be used in the program's main thread before any additional threads are created.
208 .BR ldap_get_option (3).
217 should be set appropriately.
221 will directly return the LDAP code associated to the error (or
225 should be set as well whenever appropriate.
226 .B ldap_set_urllist_proc()
227 returns LDAP_OPT_ERROR on error, and LDAP_OPT_SUCCESS on success.
231 .BR ldap_get_option (3),
232 .BR ldap_set_option (3),
233 .BR lber-sockbuf (3),