From f88b7a076be74a29a3bf876b4e2705f4a1ecf42b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 24 Oct 2007 14:16:54 -0700 Subject: This is a large patch (sorry). Migrate from struct in_addr to struct sockaddr_storage in most places that matter (ie. not the nmbd and NetBIOS lookups). This passes make test on an IPv4 box, but I'll have to do more work/testing on IPv6 enabled boxes. This should now give us a framework for testing and finishing the IPv6 migration. It's at the state where someone with a working IPv6 setup should (theorecically) be able to type : smbclient //ipv6-address/share and have it work. Jeremy. (This used to be commit 98e154c3125d5732c37a72d74b0eb5cd7b6155fd) --- source3/libads/ldap.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'source3/libads/ldap.c') diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index f85d3cd7b0..0294c4a5b5 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -221,13 +221,19 @@ bool ads_try_connect(ADS_STRUCT *ads, const char *server ) ads->config.client_site_name = SMB_STRDUP(cldap_reply.client_site_name); } - ads->server.workgroup = SMB_STRDUP(cldap_reply.netbios_domain); ads->ldap.port = LDAP_PORT; - ads->ldap.ip = *interpret_addr2(srv); + if (!interpret_string_addr(&ads->ldap.ss, srv, 0)) { + DEBUG(1,("ads_try_connect: unable to convert %s " + "to an address\n", + srv)); + SAFE_FREE( srv ); + return False; + } + SAFE_FREE(srv); - + /* Store our site name. */ sitename_store( cldap_reply.domain, cldap_reply.client_site_name ); @@ -306,10 +312,10 @@ static NTSTATUS ads_find_dc(ADS_STRUCT *ads) /* if we fail this loop, then giveup since all the IP addresses returned were dead */ for ( i=0; ildap); ads->ldap.last_attempt = time(NULL); @@ -378,7 +385,7 @@ ADS_STATUS ads_connect(ADS_STRUCT *ads) /* try with a user specified server */ - if (ads->server.ldap_server && + if (ads->server.ldap_server && ads_try_connect(ads, ads->server.ldap_server)) { goto got_connection; } @@ -391,7 +398,9 @@ ADS_STATUS ads_connect(ADS_STRUCT *ads) return ADS_ERROR_NT(ntstatus); got_connection: - DEBUG(3,("Connected to LDAP server %s\n", inet_ntoa(ads->ldap.ip))); + + print_sockaddr(addr, sizeof(addr), &ads->ldap.ss); + DEBUG(3,("Connected to LDAP server %s\n", addr)); if (!ads->auth.user_name) { /* Must use the userPrincipalName value here or sAMAccountName @@ -405,7 +414,8 @@ got_connection: } if (!ads->auth.kdc_server) { - ads->auth.kdc_server = SMB_STRDUP(inet_ntoa(ads->ldap.ip)); + print_sockaddr(addr, sizeof(addr), &ads->ldap.ss); + ads->auth.kdc_server = SMB_STRDUP(addr); } #if KRB5_DNS_HACK @@ -440,8 +450,9 @@ got_connection: /* cache the successful connection for workgroup and realm */ if (ads_closest_dc(ads)) { - saf_store( ads->server.workgroup, inet_ntoa(ads->ldap.ip)); - saf_store( ads->server.realm, inet_ntoa(ads->ldap.ip)); + print_sockaddr(addr, sizeof(addr), &ads->ldap.ss); + saf_store( ads->server.workgroup, addr); + saf_store( ads->server.realm, addr); } ldap_set_option(ads->ldap.ld, LDAP_OPT_PROTOCOL_VERSION, &version); -- cgit