From c8201c05f018cacb6aab55c0ef94996f11a9ad84 Mon Sep 17 00:00:00 2001 From: David Holder Date: Tue, 12 May 2015 16:09:54 +0100 Subject: [PATCH] Add IPv6 support to ADS client side LDAP connects. Corrected format for IPv6 LDAP URI. Signed-off-by: David Holder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BUG: https://bugzilla.samba.org/show_bug.cgi?id=11281 Signed-off-by: David Holder Reviewed-by: Jeremy Allison Reviewed-by: Ralph Böhme (cherry picked from commit c324d7901c991a6700abdc3ee701920fea5e5819) --- source3/libads/ldap.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index b46f510..70301de 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -79,7 +79,13 @@ static void gotalarm_sig(int signum) /* End setup timeout. */ } - 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; } -- 2.2.0.rc0.207.ga3a616c