summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/curl_multibyte.c7
-rw-r--r--lib/curl_multibyte.h12
-rw-r--r--lib/ldap.c36
3 files changed, 23 insertions, 32 deletions
diff --git a/lib/curl_multibyte.c b/lib/curl_multibyte.c
index 6c02239eb..6e657228c 100644
--- a/lib/curl_multibyte.c
+++ b/lib/curl_multibyte.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -22,7 +22,8 @@
#include "curl_setup.h"
-#if defined(USE_WIN32_IDN) || (defined(USE_WINDOWS_SSPI) && defined(UNICODE))
+#if defined(USE_WIN32_IDN) || ((defined(USE_WINDOWS_SSPI) || \
+ defined(CURL_LDAP_WIN)) && defined(UNICODE))
/*
* MultiByte conversions using Windows kernel32 library.
@@ -79,4 +80,4 @@ char *Curl_convert_wchar_to_UTF8(const wchar_t *str_w)
return str_utf8;
}
-#endif /* USE_WIN32_IDN || (USE_WINDOWS_SSPI && UNICODE) */
+#endif /* USE_WIN32_IDN || ((USE_WINDOWS_SSPI || CURL_LDAP_WIN) && UNICODE) */
diff --git a/lib/curl_multibyte.h b/lib/curl_multibyte.h
index 7ee5eae12..c260de386 100644
--- a/lib/curl_multibyte.h
+++ b/lib/curl_multibyte.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -23,7 +23,8 @@
***************************************************************************/
#include "curl_setup.h"
-#if defined(USE_WIN32_IDN) || (defined(USE_WINDOWS_SSPI) && defined(UNICODE))
+#if defined(USE_WIN32_IDN) || ((defined(USE_WINDOWS_SSPI) || \
+ defined(CURL_LDAP_WIN)) && defined(UNICODE))
/*
* MultiByte conversions using Windows kernel32 library.
@@ -32,10 +33,11 @@
wchar_t *Curl_convert_UTF8_to_wchar(const char *str_utf8);
char *Curl_convert_wchar_to_UTF8(const wchar_t *str_w);
-#endif /* USE_WIN32_IDN || (USE_WINDOWS_SSPI && UNICODE) */
+#endif /* USE_WIN32_IDN || ((USE_WINDOWS_SSPI || CURL_LDAP_WIN) && UNICODE) */
-#if defined(USE_WIN32_IDN) || defined(USE_WINDOWS_SSPI)
+#if defined(USE_WIN32_IDN) || defined(USE_WINDOWS_SSPI) || \
+ defined(CURL_LDAP_WIN)
/*
* Macros Curl_convert_UTF8_to_tchar(), Curl_convert_tchar_to_UTF8()
@@ -85,6 +87,6 @@ typedef union {
#endif /* UNICODE */
-#endif /* USE_WIN32_IDN || USE_WINDOWS_SSPI */
+#endif /* USE_WIN32_IDN || USE_WINDOWS_SSPI || CURL_LDAP_WIN */
#endif /* HEADER_CURL_MULTIBYTE_H */
diff --git a/lib/ldap.c b/lib/ldap.c
index cba06e6b2..83cb4f13b 100644
--- a/lib/ldap.c
+++ b/lib/ldap.c
@@ -81,8 +81,7 @@
typedef struct {
char *lud_host;
int lud_port;
-#if defined(CURL_LDAP_WIN) && \
- (defined(USE_WIN32_IDN) || defined(USE_WINDOWS_SSPI))
+#if defined(CURL_LDAP_WIN)
TCHAR *lud_dn;
TCHAR **lud_attrs;
#else
@@ -90,8 +89,7 @@ typedef struct {
char **lud_attrs;
#endif
int lud_scope;
-#if defined(CURL_LDAP_WIN) && \
- (defined(USE_WIN32_IDN) || defined(USE_WINDOWS_SSPI))
+#if defined(CURL_LDAP_WIN)
TCHAR *lud_filter;
#else
char *lud_filter;
@@ -196,8 +194,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
#ifdef LDAP_OPT_NETWORK_TIMEOUT
struct timeval ldap_timeout = {10,0}; /* 10 sec connection/search timeout */
#endif
-#if defined(CURL_LDAP_WIN) && \
- (defined(USE_WIN32_IDN) || defined(USE_WINDOWS_SSPI))
+#if defined(CURL_LDAP_WIN)
TCHAR *host = NULL;
TCHAR *user = NULL;
TCHAR *passwd = NULL;
@@ -229,8 +226,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
infof(data, "LDAP local: trying to establish %s connection\n",
ldap_ssl ? "encrypted" : "cleartext");
-#if defined(CURL_LDAP_WIN) && \
- (defined(USE_WIN32_IDN) || defined(USE_WINDOWS_SSPI))
+#if defined(CURL_LDAP_WIN)
host = Curl_convert_UTF8_to_tchar(conn->host.name);
if(!host) {
result = CURLE_OUT_OF_MEMORY;
@@ -425,8 +421,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
entryIterator;
entryIterator = ldap_next_entry(server, entryIterator), num++) {
BerElement *ber = NULL;
-#if defined(CURL_LDAP_WIN) && \
- (defined(USE_WIN32_IDN) || defined(USE_WINDOWS_SSPI))
+#if defined(CURL_LDAP_WIN)
TCHAR *attribute;
#else
char *attribute; /*! suspicious that this isn't 'const' */
@@ -435,8 +430,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
/* Get the DN and write it to the client */
{
-#if defined(CURL_LDAP_WIN) && \
- (defined(USE_WIN32_IDN) || defined(USE_WINDOWS_SSPI))
+#if defined(CURL_LDAP_WIN)
TCHAR *dn = ldap_get_dn(server, entryIterator);
size_t dn_len = _tcslen(dn);
#else
@@ -474,8 +468,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
for(attribute = ldap_first_attribute(server, entryIterator, &ber);
attribute;
attribute = ldap_next_attribute(server, entryIterator, ber)) {
-#if defined(CURL_LDAP_WIN) && \
- (defined(USE_WIN32_IDN) || defined(USE_WINDOWS_SSPI))
+#if defined(CURL_LDAP_WIN)
size_t attr_len = _tcslen(attribute);
#else
size_t attr_len = strlen(attribute);
@@ -612,8 +605,7 @@ quit:
ldapssl_client_deinit();
#endif /* HAVE_LDAP_SSL && CURL_HAS_NOVELL_LDAPSDK */
-#if defined(CURL_LDAP_WIN) && \
- (defined(USE_WIN32_IDN) || defined(USE_WINDOWS_SSPI))
+#if defined(CURL_LDAP_WIN)
Curl_unicodefree(passwd);
Curl_unicodefree(user);
Curl_unicodefree(host);
@@ -753,8 +745,7 @@ static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp)
goto quit;
}
-#if defined(CURL_LDAP_WIN) && \
- (defined(USE_WIN32_IDN) || defined(USE_WINDOWS_SSPI))
+#if defined(CURL_LDAP_WIN)
/* Convert the unescapped string to a tchar */
ludp->lud_dn = Curl_convert_UTF8_to_tchar(unescapped);
@@ -792,8 +783,7 @@ static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp)
}
/* Allocate our array (+1 for the NULL entry) */
-#if defined(CURL_LDAP_WIN) && \
- (defined(USE_WIN32_IDN) || defined(USE_WINDOWS_SSPI))
+#if defined(CURL_LDAP_WIN)
ludp->lud_attrs = calloc(count + 1, sizeof(TCHAR *));
#else
ludp->lud_attrs = calloc(count + 1, sizeof(char *));
@@ -821,8 +811,7 @@ static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp)
goto quit;
}
-#if defined(CURL_LDAP_WIN) && \
- (defined(USE_WIN32_IDN) || defined(USE_WINDOWS_SSPI))
+#if defined(CURL_LDAP_WIN)
/* Convert the unescapped string to a tchar */
ludp->lud_attrs[i] = Curl_convert_UTF8_to_tchar(unescapped);
@@ -888,8 +877,7 @@ static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp)
goto quit;
}
-#if defined(CURL_LDAP_WIN) && \
- (defined(USE_WIN32_IDN) || defined(USE_WINDOWS_SSPI))
+#if defined(CURL_LDAP_WIN)
/* Convert the unescapped string to a tchar */
ludp->lud_filter = Curl_convert_UTF8_to_tchar(unescapped);