* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * 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
#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.
return str_utf8;
}
-#endif /* USE_WIN32_IDN || (USE_WINDOWS_SSPI && UNICODE) */
+#endif /* USE_WIN32_IDN || ((USE_WINDOWS_SSPI || CURL_LDAP_WIN) && UNICODE) */
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * 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
***************************************************************************/
#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.
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()
#endif /* UNICODE */
-#endif /* USE_WIN32_IDN || USE_WINDOWS_SSPI */
+#endif /* USE_WIN32_IDN || USE_WINDOWS_SSPI || CURL_LDAP_WIN */
#endif /* HEADER_CURL_MULTIBYTE_H */
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
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;
#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;
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;
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' */
/* 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
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);
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);
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);
}
/* 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 *));
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);
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);