1 /***************************************************************************
3 * Project ___| | | | _ \| |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
8 * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
10 * This software is licensed as described in the file COPYING, which
11 * you should have received as part of this distribution. The terms
12 * are also available at https://curl.haxx.se/docs/copyright.html.
14 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 * copies of the Software, and permit persons to whom the Software is
16 * furnished to do so, under the terms of the COPYING file.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 ***************************************************************************/
23 #include "curl_setup.h"
25 #if !defined(CURL_DISABLE_LDAP) && !defined(USE_OPENLDAP)
28 * Notice that USE_OPENLDAP is only a source code selection switch. When
29 * libcurl is built with USE_OPENLDAP defined the libcurl source code that
30 * gets compiled is the code from openldap.c, otherwise the code that gets
31 * compiled is the code from ldap.c.
33 * When USE_OPENLDAP is defined a recent version of the OpenLDAP library
34 * might be required for compilation and runtime. In order to use ancient
35 * OpenLDAP library versions, USE_OPENLDAP shall not be defined.
38 #ifdef USE_WIN32_LDAP /* Use Windows LDAP implementation. */
40 # ifndef LDAP_VENDOR_NAME
41 # error Your Platform SDK is NOT sufficient for LDAP support! \
42 Update your Platform SDK, or disable LDAP support!
47 # define LDAP_DEPRECATED 1 /* Be sure ldap_init() is defined. */
52 # if (defined(HAVE_LDAP_SSL) && defined(HAVE_LDAP_SSL_H))
53 # include <ldap_ssl.h>
54 # endif /* HAVE_LDAP_SSL && HAVE_LDAP_SSL_H */
57 /* These are macros in both <wincrypt.h> (in above <winldap.h>) and typedefs
58 * in BoringSSL's <openssl/x509.h>
62 # undef X509_CERT_PAIR
63 # undef X509_EXTENSIONS
67 #include <curl/curl.h>
74 #include "curl_ldap.h"
75 #include "curl_multibyte.h"
76 #include "curl_base64.h"
78 /* The last 3 #include files should be in this order */
79 #include "curl_printf.h"
80 #include "curl_memory.h"
83 #ifndef HAVE_LDAP_URL_PARSE
85 /* Use our own implementation. */
90 #if defined(USE_WIN32_LDAP)
98 #if defined(USE_WIN32_LDAP)
104 size_t lud_attrs_dups; /* how many were dup'ed, this field is not in the
105 "real" struct so can only be used in code
106 without HAVE_LDAP_URL_PARSE defined */
110 #define LDAPURLDesc CURL_LDAPURLDesc
112 static int _ldap_url_parse(const struct connectdata *conn,
114 static void _ldap_free_urldesc(LDAPURLDesc *ludp);
116 #undef ldap_free_urldesc
117 #define ldap_free_urldesc _ldap_free_urldesc
121 #define LDAP_TRACE(x) do { \
122 _ldap_trace("%u: ", __LINE__); \
126 static void _ldap_trace(const char *fmt, ...);
128 #define LDAP_TRACE(x) Curl_nop_stmt
132 static CURLcode Curl_ldap(struct connectdata *conn, bool *done);
135 * LDAP protocol handler.
138 const struct Curl_handler Curl_handler_ldap = {
140 ZERO_NULL, /* setup_connection */
141 Curl_ldap, /* do_it */
142 ZERO_NULL, /* done */
143 ZERO_NULL, /* do_more */
144 ZERO_NULL, /* connect_it */
145 ZERO_NULL, /* connecting */
146 ZERO_NULL, /* doing */
147 ZERO_NULL, /* proto_getsock */
148 ZERO_NULL, /* doing_getsock */
149 ZERO_NULL, /* domore_getsock */
150 ZERO_NULL, /* perform_getsock */
151 ZERO_NULL, /* disconnect */
152 ZERO_NULL, /* readwrite */
153 PORT_LDAP, /* defport */
154 CURLPROTO_LDAP, /* protocol */
155 PROTOPT_NONE /* flags */
160 * LDAPS protocol handler.
163 const struct Curl_handler Curl_handler_ldaps = {
164 "LDAPS", /* scheme */
165 ZERO_NULL, /* setup_connection */
166 Curl_ldap, /* do_it */
167 ZERO_NULL, /* done */
168 ZERO_NULL, /* do_more */
169 ZERO_NULL, /* connect_it */
170 ZERO_NULL, /* connecting */
171 ZERO_NULL, /* doing */
172 ZERO_NULL, /* proto_getsock */
173 ZERO_NULL, /* doing_getsock */
174 ZERO_NULL, /* domore_getsock */
175 ZERO_NULL, /* perform_getsock */
176 ZERO_NULL, /* disconnect */
177 ZERO_NULL, /* readwrite */
178 PORT_LDAPS, /* defport */
179 CURLPROTO_LDAPS, /* protocol */
180 PROTOPT_SSL /* flags */
185 static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
187 CURLcode result = CURLE_OK;
190 LDAPURLDesc *ludp = NULL;
191 LDAPMessage *ldapmsg = NULL;
192 LDAPMessage *entryIterator;
194 struct Curl_easy *data=conn->data;
195 int ldap_proto = LDAP_VERSION3;
197 char *val_b64 = NULL;
198 size_t val_b64_sz = 0;
199 curl_off_t dlsize = 0;
200 #ifdef LDAP_OPT_NETWORK_TIMEOUT
201 struct timeval ldap_timeout = {10, 0}; /* 10 sec connection/search timeout */
203 #if defined(USE_WIN32_LDAP)
206 TCHAR *passwd = NULL;
213 *done = TRUE; /* unconditionally */
214 infof(data, "LDAP local: LDAP Vendor = %s ; LDAP Version = %d\n",
215 LDAP_VENDOR_NAME, LDAP_VENDOR_VERSION);
216 infof(data, "LDAP local: %s\n", data->change.url);
218 #ifdef HAVE_LDAP_URL_PARSE
219 rc = ldap_url_parse(data->change.url, &ludp);
221 rc = _ldap_url_parse(conn, &ludp);
224 failf(data, "LDAP local: %s", ldap_err2string(rc));
225 result = CURLE_LDAP_INVALID_URL;
229 /* Get the URL scheme (either ldap or ldaps) */
230 if(conn->given->flags & PROTOPT_SSL)
232 infof(data, "LDAP local: trying to establish %s connection\n",
233 ldap_ssl ? "encrypted" : "cleartext");
235 #if defined(USE_WIN32_LDAP)
236 host = Curl_convert_UTF8_to_tchar(conn->host.name);
238 result = CURLE_OUT_OF_MEMORY;
243 if(conn->bits.user_passwd) {
244 user = Curl_convert_UTF8_to_tchar(conn->user);
245 passwd = Curl_convert_UTF8_to_tchar(conn->passwd);
246 if(!user || !passwd) {
247 result = CURLE_OUT_OF_MEMORY;
253 host = conn->host.name;
255 if(conn->bits.user_passwd) {
257 passwd = conn->passwd;
261 #ifdef LDAP_OPT_NETWORK_TIMEOUT
262 ldap_set_option(NULL, LDAP_OPT_NETWORK_TIMEOUT, &ldap_timeout);
264 ldap_set_option(NULL, LDAP_OPT_PROTOCOL_VERSION, &ldap_proto);
268 #ifdef USE_WIN32_LDAP
269 /* Win32 LDAP SDK doesn't support insecure mode without CA! */
270 server = ldap_sslinit(host, (int)conn->port, 1);
271 ldap_set_option(server, LDAP_OPT_SSL, LDAP_OPT_ON);
274 char *ldap_ca = conn->ssl_config.CAfile;
275 #if defined(CURL_HAS_NOVELL_LDAPSDK)
276 rc = ldapssl_client_init(NULL, NULL);
277 if(rc != LDAP_SUCCESS) {
278 failf(data, "LDAP local: ldapssl_client_init %s", ldap_err2string(rc));
279 result = CURLE_SSL_CERTPROBLEM;
282 if(conn->ssl_config.verifypeer) {
283 /* Novell SDK supports DER or BASE64 files. */
284 int cert_type = LDAPSSL_CERT_FILETYPE_B64;
285 if((data->set.ssl.cert_type) &&
286 (strcasecompare(data->set.ssl.cert_type, "DER")))
287 cert_type = LDAPSSL_CERT_FILETYPE_DER;
289 failf(data, "LDAP local: ERROR %s CA cert not set!",
290 (cert_type == LDAPSSL_CERT_FILETYPE_DER ? "DER" : "PEM"));
291 result = CURLE_SSL_CERTPROBLEM;
294 infof(data, "LDAP local: using %s CA cert '%s'\n",
295 (cert_type == LDAPSSL_CERT_FILETYPE_DER ? "DER" : "PEM"),
297 rc = ldapssl_add_trusted_cert(ldap_ca, cert_type);
298 if(rc != LDAP_SUCCESS) {
299 failf(data, "LDAP local: ERROR setting %s CA cert: %s",
300 (cert_type == LDAPSSL_CERT_FILETYPE_DER ? "DER" : "PEM"),
301 ldap_err2string(rc));
302 result = CURLE_SSL_CERTPROBLEM;
305 ldap_option = LDAPSSL_VERIFY_SERVER;
308 ldap_option = LDAPSSL_VERIFY_NONE;
309 rc = ldapssl_set_verify_mode(ldap_option);
310 if(rc != LDAP_SUCCESS) {
311 failf(data, "LDAP local: ERROR setting cert verify mode: %s",
312 ldap_err2string(rc));
313 result = CURLE_SSL_CERTPROBLEM;
316 server = ldapssl_init(host, (int)conn->port, 1);
318 failf(data, "LDAP local: Cannot connect to %s:%ld",
319 conn->host.dispname, conn->port);
320 result = CURLE_COULDNT_CONNECT;
323 #elif defined(LDAP_OPT_X_TLS)
324 if(conn->ssl_config.verifypeer) {
325 /* OpenLDAP SDK supports BASE64 files. */
326 if((data->set.ssl.cert_type) &&
327 (!strcasecompare(data->set.ssl.cert_type, "PEM"))) {
328 failf(data, "LDAP local: ERROR OpenLDAP only supports PEM cert-type!");
329 result = CURLE_SSL_CERTPROBLEM;
333 failf(data, "LDAP local: ERROR PEM CA cert not set!");
334 result = CURLE_SSL_CERTPROBLEM;
337 infof(data, "LDAP local: using PEM CA cert: %s\n", ldap_ca);
338 rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_CACERTFILE, ldap_ca);
339 if(rc != LDAP_SUCCESS) {
340 failf(data, "LDAP local: ERROR setting PEM CA cert: %s",
341 ldap_err2string(rc));
342 result = CURLE_SSL_CERTPROBLEM;
345 ldap_option = LDAP_OPT_X_TLS_DEMAND;
348 ldap_option = LDAP_OPT_X_TLS_NEVER;
350 rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &ldap_option);
351 if(rc != LDAP_SUCCESS) {
352 failf(data, "LDAP local: ERROR setting cert verify mode: %s",
353 ldap_err2string(rc));
354 result = CURLE_SSL_CERTPROBLEM;
357 server = ldap_init(host, (int)conn->port);
359 failf(data, "LDAP local: Cannot connect to %s:%ld",
360 conn->host.dispname, conn->port);
361 result = CURLE_COULDNT_CONNECT;
364 ldap_option = LDAP_OPT_X_TLS_HARD;
365 rc = ldap_set_option(server, LDAP_OPT_X_TLS, &ldap_option);
366 if(rc != LDAP_SUCCESS) {
367 failf(data, "LDAP local: ERROR setting SSL/TLS mode: %s",
368 ldap_err2string(rc));
369 result = CURLE_SSL_CERTPROBLEM;
373 rc = ldap_start_tls_s(server, NULL, NULL);
374 if(rc != LDAP_SUCCESS) {
375 failf(data, "LDAP local: ERROR starting SSL/TLS mode: %s",
376 ldap_err2string(rc));
377 result = CURLE_SSL_CERTPROBLEM;
382 /* we should probably never come up to here since configure
383 should check in first place if we can support LDAP SSL/TLS */
384 failf(data, "LDAP local: SSL/TLS not supported with this version "
385 "of the OpenLDAP toolkit\n");
386 result = CURLE_SSL_CERTPROBLEM;
390 #endif /* CURL_LDAP_USE_SSL */
393 server = ldap_init(host, (int)conn->port);
395 failf(data, "LDAP local: Cannot connect to %s:%ld",
396 conn->host.dispname, conn->port);
397 result = CURLE_COULDNT_CONNECT;
401 #ifdef USE_WIN32_LDAP
402 ldap_set_option(server, LDAP_OPT_PROTOCOL_VERSION, &ldap_proto);
405 rc = ldap_simple_bind_s(server, user, passwd);
406 if(!ldap_ssl && rc != 0) {
407 ldap_proto = LDAP_VERSION2;
408 ldap_set_option(server, LDAP_OPT_PROTOCOL_VERSION, &ldap_proto);
409 rc = ldap_simple_bind_s(server, user, passwd);
412 failf(data, "LDAP local: ldap_simple_bind_s %s", ldap_err2string(rc));
413 result = CURLE_LDAP_CANNOT_BIND;
417 rc = ldap_search_s(server, ludp->lud_dn, ludp->lud_scope,
418 ludp->lud_filter, ludp->lud_attrs, 0, &ldapmsg);
420 if(rc != 0 && rc != LDAP_SIZELIMIT_EXCEEDED) {
421 failf(data, "LDAP remote: %s", ldap_err2string(rc));
422 result = CURLE_LDAP_SEARCH_FAILED;
426 for(num = 0, entryIterator = ldap_first_entry(server, ldapmsg);
428 entryIterator = ldap_next_entry(server, entryIterator), num++) {
429 BerElement *ber = NULL;
430 #if defined(USE_WIN32_LDAP)
433 char *attribute; /*! suspicious that this isn't 'const' */
437 /* Get the DN and write it to the client */
441 #if defined(USE_WIN32_LDAP)
442 TCHAR *dn = ldap_get_dn(server, entryIterator);
443 name = Curl_convert_tchar_to_UTF8(dn);
447 result = CURLE_OUT_OF_MEMORY;
452 char *dn = name = ldap_get_dn(server, entryIterator);
454 name_len = strlen(name);
456 result = Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"DN: ", 4);
458 #if defined(USE_WIN32_LDAP)
459 Curl_unicodefree(name);
466 result = Curl_client_write(conn, CLIENTWRITE_BODY, (char *) name,
469 #if defined(USE_WIN32_LDAP)
470 Curl_unicodefree(name);
477 result = Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\n", 1);
479 #if defined(USE_WIN32_LDAP)
480 Curl_unicodefree(name);
487 dlsize += name_len + 5;
489 #if defined(USE_WIN32_LDAP)
490 Curl_unicodefree(name);
495 /* Get the attributes and write them to the client */
496 for(attribute = ldap_first_attribute(server, entryIterator, &ber);
498 attribute = ldap_next_attribute(server, entryIterator, ber)) {
501 #if defined(USE_WIN32_LDAP)
502 char *attr = Curl_convert_tchar_to_UTF8(attribute);
507 result = CURLE_OUT_OF_MEMORY;
512 char *attr = attribute;
514 attr_len = strlen(attr);
516 vals = ldap_get_values_len(server, entryIterator, attribute);
518 for(i = 0; (vals[i] != NULL); i++) {
519 result = Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\t", 1);
521 ldap_value_free_len(vals);
522 #if defined(USE_WIN32_LDAP)
523 Curl_unicodefree(attr);
525 ldap_memfree(attribute);
532 result = Curl_client_write(conn, CLIENTWRITE_BODY,
533 (char *) attr, attr_len);
535 ldap_value_free_len(vals);
536 #if defined(USE_WIN32_LDAP)
537 Curl_unicodefree(attr);
539 ldap_memfree(attribute);
546 result = Curl_client_write(conn, CLIENTWRITE_BODY, (char *)": ", 2);
548 ldap_value_free_len(vals);
549 #if defined(USE_WIN32_LDAP)
550 Curl_unicodefree(attr);
552 ldap_memfree(attribute);
559 dlsize += attr_len + 3;
562 (strcmp(";binary", (char *) attr + (attr_len - 7)) == 0)) {
563 /* Binary attribute, encode to base64. */
564 result = Curl_base64_encode(data,
570 ldap_value_free_len(vals);
571 #if defined(USE_WIN32_LDAP)
572 Curl_unicodefree(attr);
574 ldap_memfree(attribute);
582 result = Curl_client_write(conn, CLIENTWRITE_BODY, val_b64,
586 ldap_value_free_len(vals);
587 #if defined(USE_WIN32_LDAP)
588 Curl_unicodefree(attr);
590 ldap_memfree(attribute);
597 dlsize += val_b64_sz;
601 result = Curl_client_write(conn, CLIENTWRITE_BODY, vals[i]->bv_val,
604 ldap_value_free_len(vals);
605 #if defined(USE_WIN32_LDAP)
606 Curl_unicodefree(attr);
608 ldap_memfree(attribute);
615 dlsize += vals[i]->bv_len;
618 result = Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\n", 1);
620 ldap_value_free_len(vals);
621 #if defined(USE_WIN32_LDAP)
622 Curl_unicodefree(attr);
624 ldap_memfree(attribute);
634 /* Free memory used to store values */
635 ldap_value_free_len(vals);
638 /* Free the attribute as we are done with it */
639 #if defined(USE_WIN32_LDAP)
640 Curl_unicodefree(attr);
642 ldap_memfree(attribute);
644 result = Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\n", 1);
648 Curl_pgrsSetDownloadCounter(data, dlsize);
657 ldap_msgfree(ldapmsg);
658 LDAP_TRACE(("Received %d entries\n", num));
660 if(rc == LDAP_SIZELIMIT_EXCEEDED)
661 infof(data, "There are more than %d entries\n", num);
663 ldap_free_urldesc(ludp);
665 ldap_unbind_s(server);
666 #if defined(HAVE_LDAP_SSL) && defined(CURL_HAS_NOVELL_LDAPSDK)
668 ldapssl_client_deinit();
669 #endif /* HAVE_LDAP_SSL && CURL_HAS_NOVELL_LDAPSDK */
671 #if defined(USE_WIN32_LDAP)
672 Curl_unicodefree(passwd);
673 Curl_unicodefree(user);
674 Curl_unicodefree(host);
677 /* no data to transfer */
678 Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
679 connclose(conn, "LDAP connection always disable re-use");
685 static void _ldap_trace(const char *fmt, ...)
687 static int do_trace = -1;
691 const char *env = getenv("CURL_TRACE");
692 do_trace = (env && strtol(env, NULL, 10) > 0);
698 vfprintf(stderr, fmt, args);
703 #ifndef HAVE_LDAP_URL_PARSE
706 * Return scope-value for a scope-string.
708 static int str2scope(const char *p)
710 if(strcasecompare(p, "one"))
711 return LDAP_SCOPE_ONELEVEL;
712 if(strcasecompare(p, "onetree"))
713 return LDAP_SCOPE_ONELEVEL;
714 if(strcasecompare(p, "base"))
715 return LDAP_SCOPE_BASE;
716 if(strcasecompare(p, "sub"))
717 return LDAP_SCOPE_SUBTREE;
718 if(strcasecompare(p, "subtree"))
719 return LDAP_SCOPE_SUBTREE;
724 * Split 'str' into strings separated by commas.
725 * Note: out[] points into 'str'.
727 static bool split_str(char *str, char ***out, size_t *count)
735 s = strchr(str, ',');
738 s = strchr(++s, ',');
741 res = calloc(items, sizeof(char *));
745 for(i = 0, s = strtok_r(str, ",", &lasts); s && i < items;
746 s = strtok_r(NULL, ",", &lasts), i++)
756 * Break apart the pieces of an LDAP URL.
758 * ldap://<hostname>:<port>/<base_dn>?<attributes>?<scope>?<filter>?<ext>
760 * <hostname> already known from 'conn->host.name'.
761 * <port> already known from 'conn->remote_port'.
762 * extract the rest from 'conn->data->state.path+1'. All fields are optional.
764 * ldap://<hostname>:<port>/?<attributes>?<scope>?<filter>
765 * yields ludp->lud_dn = "".
767 * Defined in RFC4516 section 2.
769 static int _ldap_url_parse2(const struct connectdata *conn, LDAPURLDesc *ludp)
771 int rc = LDAP_SUCCESS;
778 !conn->data->state.path ||
779 conn->data->state.path[0] != '/' ||
780 !checkprefix("LDAP", conn->data->change.url))
781 return LDAP_INVALID_SYNTAX;
783 ludp->lud_scope = LDAP_SCOPE_BASE;
784 ludp->lud_port = conn->remote_port;
785 ludp->lud_host = conn->host.name;
787 /* Duplicate the path */
788 p = path = strdup(conn->data->state.path + 1);
790 return LDAP_NO_MEMORY;
792 /* Parse the DN (Distinguished Name) */
802 LDAP_TRACE(("DN '%s'\n", dn));
804 /* Unescape the DN */
805 result = Curl_urldecode(conn->data, dn, 0, &unescaped, NULL, FALSE);
812 #if defined(USE_WIN32_LDAP)
813 /* Convert the unescaped string to a tchar */
814 ludp->lud_dn = Curl_convert_UTF8_to_tchar(unescaped);
816 /* Free the unescaped string as we are done with it */
817 Curl_unicodefree(unescaped);
825 ludp->lud_dn = unescaped;
833 /* Parse the attributes. skip "??" */
842 /* Split the string into an array of attributes */
843 if(!split_str(p, &attributes, &count)) {
849 /* Allocate our array (+1 for the NULL entry) */
850 #if defined(USE_WIN32_LDAP)
851 ludp->lud_attrs = calloc(count + 1, sizeof(TCHAR *));
853 ludp->lud_attrs = calloc(count + 1, sizeof(char *));
855 if(!ludp->lud_attrs) {
863 for(i = 0; i < count; i++) {
867 LDAP_TRACE(("attr[%d] '%s'\n", i, attributes[i]));
869 /* Unescape the attribute */
870 result = Curl_urldecode(conn->data, attributes[i], 0, &unescaped, NULL,
880 #if defined(USE_WIN32_LDAP)
881 /* Convert the unescaped string to a tchar */
882 ludp->lud_attrs[i] = Curl_convert_UTF8_to_tchar(unescaped);
884 /* Free the unescaped string as we are done with it */
885 Curl_unicodefree(unescaped);
887 if(!ludp->lud_attrs[i]) {
895 ludp->lud_attrs[i] = unescaped;
898 ludp->lud_attrs_dups++;
908 /* Parse the scope. skip "??" */
914 ludp->lud_scope = str2scope(p);
915 if(ludp->lud_scope == -1) {
916 rc = LDAP_INVALID_SYNTAX;
920 LDAP_TRACE(("scope %d\n", ludp->lud_scope));
927 /* Parse the filter */
937 LDAP_TRACE(("filter '%s'\n", filter));
939 /* Unescape the filter */
940 result = Curl_urldecode(conn->data, filter, 0, &unescaped, NULL, FALSE);
947 #if defined(USE_WIN32_LDAP)
948 /* Convert the unescaped string to a tchar */
949 ludp->lud_filter = Curl_convert_UTF8_to_tchar(unescaped);
951 /* Free the unescaped string as we are done with it */
952 Curl_unicodefree(unescaped);
954 if(!ludp->lud_filter) {
960 ludp->lud_filter = unescaped;
966 rc = LDAP_INVALID_SYNTAX;
977 static int _ldap_url_parse(const struct connectdata *conn,
980 LDAPURLDesc *ludp = calloc(1, sizeof(*ludp));
985 return LDAP_NO_MEMORY;
987 rc = _ldap_url_parse2(conn, ludp);
988 if(rc != LDAP_SUCCESS) {
989 _ldap_free_urldesc(ludp);
996 static void _ldap_free_urldesc(LDAPURLDesc *ludp)
1004 free(ludp->lud_filter);
1006 if(ludp->lud_attrs) {
1007 for(i = 0; i < ludp->lud_attrs_dups; i++)
1008 free(ludp->lud_attrs[i]);
1009 free(ludp->lud_attrs);
1014 #endif /* !HAVE_LDAP_URL_PARSE */
1015 #endif /* !CURL_DISABLE_LDAP && !USE_OPENLDAP */