diff options
author | Steve Holme <steve_holme@hotmail.com> | 2015-01-03 21:54:11 +0000 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2015-01-04 22:19:30 +0000 |
commit | ea93252ef1cb3dba44312ceec824d6436c54aa08 (patch) | |
tree | 16a06478687eedcbbabe2abe54775416709f0cff /lib/ldap.c | |
parent | f6b168de4cb28337e63d68aaea255416d10f46b0 (diff) | |
download | curl-ea93252ef1cb3dba44312ceec824d6436c54aa08.tar.gz |
ldap: Fixed Unicode usage for all Win32 builds
Otherwise, the fixes in the previous commits would only be applicable
to IDN and SSPI based builds and not others such as OpenSSL with LDAP
enabled.
Diffstat (limited to 'lib/ldap.c')
-rw-r--r-- | lib/ldap.c | 36 |
1 files changed, 12 insertions, 24 deletions
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); |