summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Holder <david.holder@erion.co.uk>2015-05-27 11:10:52 -0700
committerKarolin Seeger <kseeger@samba.org>2015-06-01 23:46:18 +0200
commitccf557c470fb4102df40819d30c6bdaf01bd6a6b (patch)
tree403c2c4f2a6358cd0fb60de4dc7b77a75c0fed19
parent34cffdbed31f345ba90a7dc4035282872973e1a7 (diff)
downloadsamba-ccf557c470fb4102df40819d30c6bdaf01bd6a6b.tar.gz
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 <david.holder@erion.co.uk> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Böhme <rb@sernet.de>
-rw-r--r--source3/libads/ldap.c8
1 files changed, 7 insertions, 1 deletions
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;
}