Add IPv6 support to ADS client side LDAP connects. Corrected format for IPv6 LDAP...
authorDavid Holder <david.holder@erion.co.uk>
Tue, 12 May 2015 15:09:54 +0000 (16:09 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 12 May 2015 18:46:16 +0000 (20:46 +0200)
Signed-off-by: David Holder <david.holder@erion.co.uk>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <rb@sernet.de>
source3/libads/ldap.c

index 3f5302f0054d4f851b15ffcbd116d4fa5eb4d95c..2ad9bfdee1e50a75c332176ddb41c350087ac6b3 100644 (file)
@@ -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;
        }