2 * WLDAP32 - LDAP support for Wine
4 * Copyright 2005 Hans Leidekker
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 * This is an internal version of winldap.h where constants, types and
21 * functions are prefixed with WLDAP32_ whenever they conflict with
26 WLDAP32_LDAP_SERVER_DOWN = 0x51,
27 WLDAP32_LDAP_LOCAL_ERROR = 0x52,
28 WLDAP32_LDAP_ENCODING_ERROR = 0x53,
29 WLDAP32_LDAP_DECODING_ERROR = 0x54,
30 WLDAP32_LDAP_TIMEOUT = 0x55,
31 WLDAP32_LDAP_AUTH_UNKNOWN = 0x56,
32 WLDAP32_LDAP_FILTER_ERROR = 0x57,
33 WLDAP32_LDAP_USER_CANCELLED = 0x58,
34 WLDAP32_LDAP_PARAM_ERROR = 0x59,
35 WLDAP32_LDAP_NO_MEMORY = 0x5a,
36 WLDAP32_LDAP_CONNECT_ERROR = 0x5b,
37 WLDAP32_LDAP_NOT_SUPPORTED = 0x5c,
38 WLDAP32_LDAP_NO_RESULTS_RETURNED = 0x5e,
39 WLDAP32_LDAP_CONTROL_NOT_FOUND = 0x5d,
40 WLDAP32_LDAP_MORE_RESULTS_TO_RETURN = 0x5f,
42 WLDAP32_LDAP_CLIENT_LOOP = 0x60,
43 WLDAP32_LDAP_REFERRAL_LIMIT_EXCEEDED = 0x61
46 #define LDAP_OPT_THREAD_FN_PTRS 0x05
47 #define LDAP_OPT_REBIND_FN 0x06
48 #define LDAP_OPT_REBIND_ARG 0x07
49 #define LDAP_OPT_SSL 0x0a
50 #define LDAP_OPT_IO_FN_PTRS 0x0b
51 #define LDAP_OPT_CACHE_FN_PTRS 0x0d
52 #define LDAP_OPT_CACHE_STRATEGY 0x0e
53 #define LDAP_OPT_CACHE_ENABLE 0x0f
54 #define LDAP_OPT_REFERRAL_HOP_LIMIT 0x10
55 #define LDAP_OPT_VERSION 0x11
56 #define LDAP_OPT_SERVER_ERROR 0x33
57 #define LDAP_OPT_SERVER_EXT_ERROR 0x34
58 #define LDAP_OPT_PING_KEEP_ALIVE 0x36
59 #define LDAP_OPT_PING_WAIT_TIME 0x37
60 #define LDAP_OPT_PING_LIMIT 0x38
61 #define LDAP_OPT_DNSDOMAIN_NAME 0x3b
62 #define LDAP_OPT_GETDSNAME_FLAGS 0x3d
63 #define LDAP_OPT_HOST_REACHABLE 0x3e
64 #define LDAP_OPT_PROMPT_CREDENTIALS 0x3f
65 #define LDAP_OPT_TCP_KEEPALIVE 0x40
66 #define LDAP_OPT_FAST_CONCURRENT_BIND 0x41
67 #define LDAP_OPT_SEND_TIMEOUT 0x42
68 #define LDAP_OPT_REFERRAL_CALLBACK 0x70
69 #define LDAP_OPT_CLIENT_CERTIFICATE 0x80
70 #define LDAP_OPT_SERVER_CERTIFICATE 0x81
71 #define LDAP_OPT_AUTO_RECONNECT 0x91
72 #define LDAP_OPT_SSPI_FLAGS 0x92
73 #define LDAP_OPT_SSL_INFO 0x93
74 #define LDAP_OPT_REF_DEREF_CONN_PER_MSG 0x94
75 #define LDAP_OPT_TLS LDAP_OPT_SSL
76 #define LDAP_OPT_TLS_INFO LDAP_OPT_SSL_INFO
77 #define LDAP_OPT_SIGN 0x95
78 #define LDAP_OPT_ENCRYPT 0x96
79 #define LDAP_OPT_SASL_METHOD 0x97
80 #define LDAP_OPT_AREC_EXCLUSIVE 0x98
81 #define LDAP_OPT_SECURITY_CONTEXT 0x99
82 #define LDAP_OPT_ROOTDSE_CACHE 0x9a
106 ULONG ld_cldaptimeout;
107 ULONG ld_refhoplimit;
109 } WLDAP32_LDAP, *WLDAP32_PLDAP;
111 typedef struct ldapmodA {
116 struct berval **modv_bvals;
118 } LDAPModA, *PLDAPModA;
120 typedef struct ldapmodW {
124 PWCHAR *modv_strvals;
125 struct berval **modv_bvals;
127 } LDAPModW, *PLDAPModW;
129 typedef struct l_timeval
133 } LDAP_TIMEVAL, *PLDAP_TIMEVAL;
135 typedef struct ldapmsg
142 struct ldapmsg *lm_chain;
143 struct ldapmsg *lm_next;
146 WLDAP32_PLDAP Connection;
152 BOOLEAN ConnectionReferenced;
153 } WLDAP32_LDAPMessage, *WLDAP32_PLDAPMessage;
155 #define LAPI_MAJOR_VER1 1
156 #define LAPI_MINOR_VER1 1
158 typedef struct ldap_version_info
163 } LDAP_VERSION_INFO, *PLDAP_VERSION_INFO;
165 typedef struct WLDAP32_berval
169 } LDAP_BERVAL, *PLDAP_BERVAL, BERVAL, *PBERVAL, WLDAP32_BerValue;
171 typedef struct ldapcontrolA
174 struct WLDAP32_berval ldctl_value;
175 BOOLEAN ldctl_iscritical;
176 } LDAPControlA, *PLDAPControlA;
178 typedef struct ldapcontrolW
181 struct WLDAP32_berval ldctl_value;
182 BOOLEAN ldctl_iscritical;
183 } LDAPControlW, *PLDAPControlW;
185 typedef struct ldapsearch LDAPSearch, *PLDAPSearch;
187 typedef struct ldapsortkeyA
190 PCHAR sk_matchruleoid;
191 BOOLEAN sk_reverseorder;
192 } LDAPSortKeyA, *PLDAPSortKeyA;
194 typedef struct ldapsortkeyW
197 PWCHAR sk_matchruleoid;
198 BOOLEAN sk_reverseorder;
199 } LDAPSortKeyW, *PLDAPSortKeyW;
201 typedef struct ldapapiinfoA
203 int ldapai_info_version;
204 int ldapai_api_version;
205 int ldapai_protocol_version;
206 char **ldapai_extensions;
207 char *ldapai_vendor_name;
208 int ldapai_vendor_version;
211 typedef struct ldapapiinfoW
213 int ldapai_info_version;
214 int ldapai_api_version;
215 int ldapai_protocol_version;
216 PWCHAR *ldapai_extensions;
217 PWCHAR ldapai_vendor_name;
218 int ldapai_vendor_version;
221 typedef struct ldap_apifeature_infoA
223 int ldapaif_info_version;
226 } LDAPAPIFeatureInfoA;
228 typedef struct ldap_apifeature_infoW
230 int ldapaif_info_version;
233 } LDAPAPIFeatureInfoW;
235 ULONG ldap_addA(WLDAP32_LDAP*,PCHAR,LDAPModA*[]);
236 ULONG ldap_addW(WLDAP32_LDAP*,PWCHAR,LDAPModW*[]);
237 ULONG ldap_add_extA(WLDAP32_LDAP*,PCHAR,LDAPModA*[],PLDAPControlA*,PLDAPControlA*,ULONG*);
238 ULONG ldap_add_extW(WLDAP32_LDAP*,PWCHAR,LDAPModW*[],PLDAPControlW*,PLDAPControlW*,ULONG*);
239 ULONG ldap_add_ext_sA(WLDAP32_LDAP*,PCHAR,LDAPModA*[],PLDAPControlA*,PLDAPControlA*);
240 ULONG ldap_add_ext_sW(WLDAP32_LDAP*,PWCHAR,LDAPModW*[],PLDAPControlW*,PLDAPControlW*);
241 ULONG ldap_add_sA(WLDAP32_LDAP*,PCHAR,LDAPModA*[]);
242 ULONG ldap_add_sW(WLDAP32_LDAP*,PWCHAR,LDAPModW*[]);
243 ULONG ldap_bindA(WLDAP32_LDAP*,PCHAR,PCHAR,ULONG);
244 ULONG ldap_bindW(WLDAP32_LDAP*,PWCHAR,PWCHAR,ULONG);
245 ULONG ldap_bind_sA(WLDAP32_LDAP*,PCHAR,PCHAR,ULONG);
246 ULONG ldap_bind_sW(WLDAP32_LDAP*,PWCHAR,PWCHAR,ULONG);
247 ULONG ldap_compareA(WLDAP32_LDAP*,PCHAR,PCHAR,PCHAR);
248 ULONG ldap_compareW(WLDAP32_LDAP*,PWCHAR,PWCHAR,PWCHAR);
249 ULONG ldap_compare_extA(WLDAP32_LDAP*,PCHAR,PCHAR,PCHAR,struct WLDAP32_berval*,PLDAPControlA*,PLDAPControlA*,ULONG*);
250 ULONG ldap_compare_extW(WLDAP32_LDAP*,PWCHAR,PWCHAR,PWCHAR,struct WLDAP32_berval*,PLDAPControlW*,PLDAPControlW*,ULONG*);
251 ULONG ldap_compare_ext_sA(WLDAP32_LDAP*,PCHAR,PCHAR,PCHAR,struct WLDAP32_berval*,PLDAPControlA*,PLDAPControlA*);
252 ULONG ldap_compare_ext_sW(WLDAP32_LDAP*,PWCHAR,PWCHAR,PWCHAR,struct WLDAP32_berval*,PLDAPControlW*,PLDAPControlW*);
253 ULONG ldap_compare_sA(WLDAP32_LDAP*,PCHAR,PCHAR,PCHAR);
254 ULONG ldap_compare_sW(WLDAP32_LDAP*,PWCHAR,PWCHAR,PWCHAR);
255 PCHAR ldap_dn2ufnA(PCHAR);
256 PWCHAR ldap_dn2ufnW(PWCHAR);
257 PCHAR ldap_err2stringA(ULONG);
258 PWCHAR ldap_err2stringW(ULONG);
259 PCHAR *ldap_explode_dnA(PCHAR,ULONG);
260 PWCHAR *ldap_explode_dnW(PWCHAR,ULONG);
261 PCHAR ldap_get_dnA(WLDAP32_LDAP*,WLDAP32_LDAPMessage*);
262 PWCHAR ldap_get_dnW(WLDAP32_LDAP*,WLDAP32_LDAPMessage*);
263 ULONG ldap_get_optionA(WLDAP32_LDAP*,int,void*);
264 ULONG ldap_get_optionW(WLDAP32_LDAP*,int,void*);
265 WLDAP32_LDAP *ldap_initA(const PCHAR,ULONG);
266 WLDAP32_LDAP *ldap_initW(const PWCHAR,ULONG);
267 void ldap_memfreeA(PCHAR);
268 void ldap_memfreeW(PWCHAR);
269 WLDAP32_LDAP *ldap_openA(PCHAR,ULONG);
270 WLDAP32_LDAP *ldap_openW(PWCHAR,ULONG);
271 void WLDAP32_ldap_perror(WLDAP32_LDAP*,const PCHAR);
272 ULONG WLDAP32_ldap_result2error(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,ULONG);
273 ULONG ldap_sasl_bindA(WLDAP32_LDAP*,const PCHAR,const PCHAR,const BERVAL*,PLDAPControlA*,PLDAPControlA*,int*);
274 ULONG ldap_sasl_bindW(WLDAP32_LDAP*,const PWCHAR,const PWCHAR,const BERVAL*,PLDAPControlW*,PLDAPControlW*,int*);
275 ULONG ldap_sasl_bind_sA(WLDAP32_LDAP*,const PCHAR,const PCHAR,const BERVAL*,PLDAPControlA*,PLDAPControlA*,PBERVAL*);
276 ULONG ldap_sasl_bind_sW(WLDAP32_LDAP*,const PWCHAR,const PWCHAR,const BERVAL*,PLDAPControlW*,PLDAPControlW*,PBERVAL*);
277 ULONG ldap_searchA(WLDAP32_LDAP*,PCHAR,ULONG,PCHAR,PCHAR[],ULONG);
278 ULONG ldap_searchW(WLDAP32_LDAP*,PWCHAR,ULONG,PWCHAR,PWCHAR[],ULONG);
279 ULONG ldap_search_extA(WLDAP32_LDAP*,PCHAR,ULONG,PCHAR,PCHAR[],ULONG,PLDAPControlA*,
280 PLDAPControlA*,ULONG,ULONG,ULONG*);
281 ULONG ldap_search_extW(WLDAP32_LDAP*,PWCHAR,ULONG,PWCHAR,PWCHAR[],ULONG,PLDAPControlW*,
282 PLDAPControlW*,ULONG,ULONG,ULONG*);
283 ULONG ldap_search_ext_sA(WLDAP32_LDAP*,PCHAR,ULONG,PCHAR,PCHAR[],ULONG,PLDAPControlA*,
284 PLDAPControlA*,struct l_timeval*,ULONG,WLDAP32_LDAPMessage**);
285 ULONG ldap_search_ext_sW(WLDAP32_LDAP*,PWCHAR,ULONG,PWCHAR,PWCHAR[],ULONG,PLDAPControlW*,
286 PLDAPControlW*,struct l_timeval*,ULONG,WLDAP32_LDAPMessage**);
287 ULONG ldap_search_sA(WLDAP32_LDAP*,PCHAR,ULONG,PCHAR,PCHAR[],ULONG,WLDAP32_LDAPMessage**);
288 ULONG ldap_search_sW(WLDAP32_LDAP*,PWCHAR,ULONG,PWCHAR,PWCHAR[],ULONG,WLDAP32_LDAPMessage**);
289 ULONG ldap_search_stA(WLDAP32_LDAP*,const PCHAR,ULONG,const PCHAR,PCHAR[],ULONG,
290 struct l_timeval*,WLDAP32_LDAPMessage**);
291 ULONG ldap_search_stW(WLDAP32_LDAP*,const PWCHAR,ULONG,const PWCHAR,PWCHAR[],ULONG,
292 struct l_timeval*,WLDAP32_LDAPMessage**);
293 ULONG ldap_set_optionA(WLDAP32_LDAP*,int,void*);
294 ULONG ldap_set_optionW(WLDAP32_LDAP*,int,void*);
295 ULONG ldap_simple_bindA(WLDAP32_LDAP*,PCHAR,PCHAR);
296 ULONG ldap_simple_bindW(WLDAP32_LDAP*,PWCHAR,PWCHAR);
297 ULONG ldap_simple_bind_sA(WLDAP32_LDAP*,PCHAR,PCHAR);
298 ULONG ldap_simple_bind_sW(WLDAP32_LDAP*,PWCHAR,PWCHAR);
299 ULONG ldap_start_tls_sA(WLDAP32_PLDAP,PULONG,WLDAP32_LDAPMessage**,PLDAPControlA*,PLDAPControlA*);
300 ULONG ldap_start_tls_sW(WLDAP32_PLDAP,PULONG,WLDAP32_LDAPMessage**,PLDAPControlW*,PLDAPControlW*);
301 ULONG ldap_ufn2dnA(PCHAR,PCHAR*);
302 ULONG ldap_ufn2dnW(PWCHAR,PWCHAR*);
303 ULONG WLDAP32_ldap_unbind(WLDAP32_LDAP*);
304 ULONG WLDAP32_ldap_unbind_s(WLDAP32_LDAP*);
305 ULONG ldap_value_freeA(PCHAR*);
306 ULONG ldap_value_freeW(PWCHAR*);
308 ULONG LdapGetLastError(void);
309 ULONG LdapMapErrorToWin32(ULONG);
310 int LdapUnicodeToUTF8(LPCWSTR,int,LPSTR,int);
311 int LdapUTF8ToUnicode(LPCSTR,int,LPWSTR,int);