]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Add IPv6 support to ADS client side LDAP connects. Corrected format for IPv6 LDAP...
authorDavid Holder <david.holder@erion.co.uk>
Wed, 27 May 2015 18:10:52 +0000 (11:10 -0700)
committerKarolin Seeger <kseeger@samba.org>
Mon, 1 Jun 2015 21:46:18 +0000 (23:46 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11281

(Back ported from commit c324d7901c991a6700abdc3ee701920fea5e5819)

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 b9adc9d9184428d4dd330671c25a45df18821b62..c1eecec38026ddc04df030b999e1b22b4a7e1712 100644 (file)
@@ -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;
                }