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>
#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;
}