From d5b7070b38f6152a52c2e08f81f1f1ee63d3091a 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 Signed-off-by: David Holder Reviewed-by: Jeremy Allison --- 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 3f5302f..2ad9bfd 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