summaryrefslogtreecommitdiff
path: root/Utilities/cmcurl/lib/ldap.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-03-04 14:34:39 -0500
committerBrad King <brad.king@kitware.com>2020-03-04 14:34:39 -0500
commitd61c3bd50520ce0179f52a129d5c660aebad88ba (patch)
tree4476c31b8b03de36811d94b5d9282318e84784b2 /Utilities/cmcurl/lib/ldap.c
parent84dc14a967b78431c95ed3203e5dd301b6897267 (diff)
parent735ea3001ae98636a4cb7caf15a40960c0da39a1 (diff)
downloadcmake-d61c3bd50520ce0179f52a129d5c660aebad88ba.tar.gz
Merge branch 'upstream-curl' into update-curl
* upstream-curl: curl 2020-03-04 (b8d13668)
Diffstat (limited to 'Utilities/cmcurl/lib/ldap.c')
-rw-r--r--Utilities/cmcurl/lib/ldap.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/Utilities/cmcurl/lib/ldap.c b/Utilities/cmcurl/lib/ldap.c
index fd31faa3e7..771edb4e98 100644
--- a/Utilities/cmcurl/lib/ldap.c
+++ b/Utilities/cmcurl/lib/ldap.c
@@ -112,13 +112,19 @@ static void _ldap_free_urldesc(LDAPURLDesc *ludp);
#define LDAP_TRACE(x) do { \
_ldap_trace("%u: ", __LINE__); \
_ldap_trace x; \
- } WHILE_FALSE
+ } while(0)
static void _ldap_trace(const char *fmt, ...);
#else
#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);
@@ -838,10 +844,10 @@ static bool split_str(char *str, char ***out, size_t *count)
static int _ldap_url_parse2(const struct connectdata *conn, LDAPURLDesc *ludp)
{
int rc = LDAP_SUCCESS;
- char *path;
- char *query;
char *p;
- char *q;
+ char *path;
+ char *q = NULL;
+ char *query = NULL;
size_t i;
if(!conn->data ||
@@ -859,11 +865,13 @@ static int _ldap_url_parse2(const struct connectdata *conn, LDAPURLDesc *ludp)
if(!path)
return LDAP_NO_MEMORY;
- /* Duplicate the query */
- q = query = strdup(conn->data->state.up.query);
- if(!query) {
- free(path);
- return LDAP_NO_MEMORY;
+ /* Duplicate the query if present */
+ if(conn->data->state.up.query) {
+ q = query = strdup(conn->data->state.up.query);
+ if(!query) {
+ free(path);
+ return LDAP_NO_MEMORY;
+ }
}
/* Parse the DN (Distinguished Name) */