From: Daniel Stenberg Date: Sat, 30 Mar 2024 10:14:54 +0000 (+0100) Subject: openldap: create ldap URLs correctly for IPv6 addresses X-Git-Tag: curl-8_8_0~331 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=56935a7dada6975d5a46aa494de0af195e4e8659;p=thirdparty%2Fcurl.git openldap: create ldap URLs correctly for IPv6 addresses Reported-by: Sergio Durigan Junior Fixes #13228 Closes #13235 --- diff --git a/lib/openldap.c b/lib/openldap.c index 47266f64e4..85a37b8186 100644 --- a/lib/openldap.c +++ b/lib/openldap.c @@ -548,9 +548,12 @@ static CURLcode oldap_connect(struct Curl_easy *data, bool *done) return result; } - hosturl = aprintf("ldap%s://%s:%d", - conn->handler->flags & PROTOPT_SSL? "s": "", - conn->host.name, conn->remote_port); + hosturl = aprintf("%s://%s%s%s:%d", + conn->handler->scheme, + conn->bits.ipv6_ip? "[": "", + conn->host.name, + conn->bits.ipv6_ip? "]": "", + conn->remote_port); if(!hosturl) return CURLE_OUT_OF_MEMORY;