From: David Holder Date: Wed, 27 May 2015 18:10:52 +0000 (-0700) Subject: Add IPv6 support to ADS client side LDAP connects. Corrected format for IPv6 LDAP... X-Git-Tag: samba-4.1.19~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ccf557c470fb4102df40819d30c6bdaf01bd6a6b;p=thirdparty%2Fsamba.git Add IPv6 support to ADS client side LDAP connects. Corrected format for IPv6 LDAP URI. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11281 (Back ported from commit c324d7901c991a6700abdc3ee701920fea5e5819) Signed-off-by: David Holder Reviewed-by: Jeremy Allison Reviewed-by: Ralph Böhme --- diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index b9adc9d9184..c1eecec3802 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -87,7 +87,13 @@ static void gotalarm_sig(int signum) #ifndef LDAP_PROTO_TCP #define LDAP_PROTO_TCP 1 #endif - uri = talloc_asprintf(talloc_tos(), "ldap://%s:%u", server, port); + if ( strchr_m(server, ':') ) { + /* IPv6 URI */ + uri = talloc_asprintf(talloc_tos(), "ldap://[%s]:%u", server, port); + } else { + /* IPv4 URI */ + uri = talloc_asprintf(talloc_tos(), "ldap://%s:%u", server, port); + } if (uri == NULL) { return NULL; }