From 8e54530b52fd256137740107e9fdf000f00a7a30 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 10 Oct 2007 18:25:16 -0700 Subject: Add start of IPv6 implementation. Currently most of this is avoiding IPv6 in winbindd, but moves most of the socket functions that were wrongly in lib/util.c into lib/util_sock.c and provides generic IPv4/6 independent versions of most things. Still lots of work to do, but now I can see how I'll fix the access check code. Nasty part that remains is the name resolution code which is used to returning arrays of in_addr structs. Jeremy. (This used to be commit 3f6bd0e1ec5cc6670f3d08f76fc2cd94c9cd1a08) --- source3/utils/net.c | 11 +++++------ source3/utils/net_dns.c | 3 +-- source3/utils/netlookup.c | 3 ++- source3/utils/nmblookup.c | 7 +++++-- source3/utils/smbcacls.c | 2 +- source3/utils/smbcquotas.c | 2 +- 6 files changed, 15 insertions(+), 13 deletions(-) (limited to 'source3/utils') diff --git a/source3/utils/net.c b/source3/utils/net.c index 88283ac145..f9af7a41ca 100644 --- a/source3/utils/net.c +++ b/source3/utils/net.c @@ -89,7 +89,6 @@ BOOL opt_testmode = False; BOOL opt_have_ip = False; struct in_addr opt_dest_ip; -extern struct in_addr loopback_ip; extern BOOL AllowDebugChange; uint32 get_sec_channel_type(const char *param) @@ -407,7 +406,7 @@ BOOL net_find_server(const char *domain, unsigned flags, struct in_addr *server_ if (get_pdc_ip(d, &pdc_ip)) { fstring dc_name; - if (is_zero_ip(pdc_ip)) + if (is_zero_ip_v4(pdc_ip)) return False; if ( !name_status_find(d, 0x1b, 0x20, pdc_ip, dc_name) ) @@ -437,7 +436,7 @@ BOOL net_find_server(const char *domain, unsigned flags, struct in_addr *server_ } *server_name = SMB_STRDUP(inet_ntoa(opt_dest_ip)); } else if (!(flags & NET_FLAGS_LOCALHOST_DEFAULT_INSANE)) { - *server_ip = loopback_ip; + (*server_ip).s_addr = htonl(INADDR_LOOPBACK); *server_name = SMB_STRDUP("127.0.0.1"); } @@ -453,7 +452,7 @@ BOOL net_find_server(const char *domain, unsigned flags, struct in_addr *server_ BOOL net_find_pdc(struct in_addr *server_ip, fstring server_name, const char *domain_name) { if (get_pdc_ip(domain_name, server_ip)) { - if (is_zero_ip(*server_ip)) + if (is_zero_ip_v4(*server_ip)) return False; if (!name_status_find(domain_name, 0x1b, 0x20, *server_ip, server_name)) @@ -990,7 +989,7 @@ static struct functable net_func[] = { TALLOC_CTX *frame = talloc_stackframe(); - zero_ip(&opt_dest_ip); + zero_ip_v4(&opt_dest_ip); load_case_tables(); @@ -1009,7 +1008,7 @@ static struct functable net_func[] = { break; case 'I': opt_dest_ip = *interpret_addr2(poptGetOptArg(pc)); - if (is_zero_ip(opt_dest_ip)) + if (is_zero_ip_v4(opt_dest_ip)) d_fprintf(stderr, "\nInvalid ip address specified\n"); else opt_have_ip = True; diff --git a/source3/utils/net_dns.c b/source3/utils/net_dns.c index e1993488f5..716192b057 100644 --- a/source3/utils/net_dns.c +++ b/source3/utils/net_dns.c @@ -145,7 +145,6 @@ int get_my_ip_address( struct in_addr **ips ) { struct iface_struct nics[MAX_INTERFACES]; int i, n; - struct in_addr loopback_ip = *interpret_addr2("127.0.0.1"); struct in_addr *list; int count = 0; @@ -158,7 +157,7 @@ int get_my_ip_address( struct in_addr **ips ) } for ( i=0; i= 0; j--) { - bcast = iface_n_bcast(j); + bcast = iface_n_bcast_v4(j); + if (!bcast) { + continue; + } d_printf("querying %s on %s\n", lookup, inet_ntoa(*bcast)); ip_list = name_query(ServerFD,lookup,lookup_type, diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c index 6324dcc192..dbb067477e 100644 --- a/source3/utils/smbcacls.c +++ b/source3/utils/smbcacls.c @@ -768,7 +768,7 @@ static struct cli_state *connect_one(const char *share) struct cli_state *c; struct in_addr ip; NTSTATUS nt_status; - zero_ip(&ip); + zero_ip_v4(&ip); if (!cmdline_auth_info.got_pass) { char *pass = getpass("Password: "); diff --git a/source3/utils/smbcquotas.c b/source3/utils/smbcquotas.c index 8d954ac20a..1f718b7cef 100644 --- a/source3/utils/smbcquotas.c +++ b/source3/utils/smbcquotas.c @@ -360,7 +360,7 @@ static struct cli_state *connect_one(const char *share) struct cli_state *c; struct in_addr ip; NTSTATUS nt_status; - zero_ip(&ip); + zero_ip_v4(&ip); if (!cmdline_auth_info.got_pass) { char *pass = getpass("Password: "); -- cgit