summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Satiro <raysatiro@yahoo.com>2019-08-27 14:20:20 -0400
committerJay Satiro <raysatiro@yahoo.com>2019-09-11 02:44:47 -0400
commit08f96982a910eb83e2be03a7db1305c8668f9668 (patch)
treecce23e14155fe47e61e09208a0d027b4dfb89e32
parent9cd755e1d768bbf228e7c9faf223b7459f7e0105 (diff)
downloadcurl-08f96982a910eb83e2be03a7db1305c8668f9668.tar.gz
ldap: Stop using wide char version of ldapp_err2string
Despite ldapp_err2string being documented by MS as returning a PCHAR (char *), when UNICODE it is mapped to ldap_err2stringW and returns PWCHAR (wchar_t *). We have lots of code that expects ldap_err2string to return char *, most of it failf used like this: failf(data, "LDAP local: Some error: %s", ldap_err2string(rc)); Closes https://github.com/curl/curl/pull/4272
-rw-r--r--lib/ldap.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/ldap.c b/lib/ldap.c
index fd31faa3e..d7d90fea7 100644
--- a/lib/ldap.c
+++ b/lib/ldap.c
@@ -119,6 +119,12 @@ static void _ldap_free_urldesc(LDAPURLDesc *ludp);
#define LDAP_TRACE(x) Curl_nop_stmt
#endif
+#if defined(USE_WIN32_LDAP) && defined(ldap_err2string)
+/* Use ansi error strings in UNICODE builds */
+#undef ldap_err2string
+#define ldap_err2string ldap_err2stringA
+#endif
+
static CURLcode Curl_ldap(struct connectdata *conn, bool *done);