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/krb5_setpw.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'source3/libads/krb5_setpw.c') diff --git a/source3/libads/krb5_setpw.c b/source3/libads/krb5_setpw.c index 73dffe7c1b..831a448847 100644 --- a/source3/libads/krb5_setpw.c +++ b/source3/libads/krb5_setpw.c @@ -402,11 +402,14 @@ static ADS_STATUS do_krb5_kpasswd_request(krb5_context context, int ret, sock; socklen_t addr_len; struct sockaddr remote_addr, local_addr; - struct in_addr *addr = interpret_addr2(kdc_host); + struct sockaddr_storage addr; krb5_address local_kaddr, remote_kaddr; bool use_tcp = False; + if (!interpret_string_addr(&addr, kdc_host, 0)) { + } + ret = krb5_mk_req_extended(context, &auth_context, AP_OPTS_USE_SUBKEY, NULL, credsp, &ap_req); if (ret) { @@ -422,7 +425,7 @@ static ADS_STATUS do_krb5_kpasswd_request(krb5_context context, } else { - sock = open_socket_out(SOCK_STREAM, addr, DEFAULT_KPASSWD_PORT, + sock = open_socket_out(SOCK_STREAM, &addr, DEFAULT_KPASSWD_PORT, LONG_CONNECT_TIMEOUT); } @@ -430,18 +433,29 @@ static ADS_STATUS do_krb5_kpasswd_request(krb5_context context, int rc = errno; SAFE_FREE(ap_req.data); krb5_auth_con_free(context, auth_context); - DEBUG(1,("failed to open kpasswd socket to %s (%s)\n", + DEBUG(1,("failed to open kpasswd socket to %s (%s)\n", kdc_host, strerror(errno))); return ADS_ERROR_SYSTEM(rc); } - addr_len = sizeof(remote_addr); getpeername(sock, &remote_addr, &addr_len); addr_len = sizeof(local_addr); getsockname(sock, &local_addr, &addr_len); - - setup_kaddr(&remote_kaddr, &remote_addr); - setup_kaddr(&local_kaddr, &local_addr); + + /* FIXME ! How do we do IPv6 here ? JRA. */ + if (remote_addr.sa_family != AF_INET || + local_addr.sa_family != AF_INET) { + DEBUG(1,("do_krb5_kpasswd_request: " + "no IPv6 support (yet).\n")); + close(sock); + SAFE_FREE(ap_req.data); + krb5_auth_con_free(context, auth_context); + errno = EINVAL; + return ADS_ERROR_SYSTEM(EINVAL); + } + + setup_kaddr_v4(&remote_kaddr, &remote_addr); + setup_kaddr_v4(&local_kaddr, &local_addr); ret = krb5_auth_con_setaddrs(context, auth_context, &local_kaddr, NULL); if (ret) { -- cgit