1 .TH LDAP_OPEN 3 "RELEASEDATE" "OpenLDAP LDVERSION"
3 .\" Copyright 1998-2006 The OpenLDAP Foundation All Rights Reserved.
4 .\" Copying restrictions apply. See COPYRIGHT/LICENSE.
6 ldap_init, 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)
28 opens a connection to an LDAP server and allocates an LDAP
29 structure which is used to identify
30 the connection and to maintain per-connection information.
32 allocates an LDAP structure but does not open an initial connection. One
33 of these two routines must be called before any operations are attempted.
36 takes \fIhost\fP, the hostname on which the LDAP server is
37 running, and \fIport\fP, the port number to which to connect. If the default
38 IANA-assigned port of 389 is desired, LDAP_PORT should be specified for
39 \fIport\fP. The \fIhost\fP parameter may contain a blank-separated list
40 of hosts to try to connect to, and each host may optionally by of the form
41 \fIhost:port\fP. If present, the \fI:port\fP overrides the \fIport\fP
44 Upon successfully making a connection to an
47 returns a pointer to an LDAP structure (defined below), which
48 should be passed to subsequent calls to
51 etc. Certain fields in the LDAP structure can be set to indicate size limit,
52 time limit, and how aliases are handled during operations. See <ldap.h>
58 /* ... other stuff you should not mess with ... */
61 #define LDAP_DEREF_NEVER 0
62 #define LDAP_DEREF_SEARCHING 1
63 #define LDAP_DEREF_FINDING 2
64 #define LDAP_DEREF_ALWAYS 3
67 #define LDAP_NO_LIMIT 0
72 unsigned long ld_options;
73 #define LDAP_OPT_REFERRALS 0x00000002 /* set by default */
74 #define LDAP_OPT_RESTART 0x00000004
75 /* ... other stuff you should not mess with ... */
84 but does not open a connection
85 to the LDAP server. The actual connection open will occur when the
86 first operation is attempted. At this time,
89 .B ldap_open() will be depreciated in a later release.
91 If an error occurs, these routines will return NULL and errno should be
94 Options that affect a particular LDAP instance may be set by modifying
95 the \fIld_options\fP field in the LDAP structure. This field is set
96 to \fILDAP_OPT_REFERRALS\fP in
99 which causes the library to automatically follow referrals
100 to other servers that may be returned in response to an LDAP operation.
102 The other supported option is \fILDAP_OPT_RESTART\fP, which if set will
103 cause the LDAP library to restart the
105 system call when it is interrupted by the system (i.e., errno is set to
106 EINTR). This option is not supported on the Macintosh and under MS-DOS.
108 An option can be turned off by clearing the appropriate bit in the
109 \fIld_options\fP field.
111 There are other elements in the LDAP structure that you should not
112 change. You should not make any assumptions about the order of elements
113 in the LDAP structure.
120 is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
122 is derived from University of Michigan LDAP 3.3 Release.