summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-10-10 18:25:16 -0700
committerJeremy Allison <jra@samba.org>2007-10-10 18:25:16 -0700
commit8e54530b52fd256137740107e9fdf000f00a7a30 (patch)
treef9ca56cc0b2eff78c3550c924c79ee4ca0666fd2 /source3/utils
parent0ec55a246238b6cfb3727942c20cd55a16ab4d4a (diff)
downloadsamba-8e54530b52fd256137740107e9fdf000f00a7a30.tar.gz
samba-8e54530b52fd256137740107e9fdf000f00a7a30.tar.bz2
samba-8e54530b52fd256137740107e9fdf000f00a7a30.zip
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)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net.c11
-rw-r--r--source3/utils/net_dns.c3
-rw-r--r--source3/utils/netlookup.c3
-rw-r--r--source3/utils/nmblookup.c7
-rw-r--r--source3/utils/smbcacls.c2
-rw-r--r--source3/utils/smbcquotas.c2
6 files changed, 15 insertions, 13 deletions
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<n; i++ ) {
- if ( nics[i].iface_addr.ip.s_addr != loopback_ip.s_addr ) {
+ if (!is_loopback_ip_v4(nics[i].iface_addr.ip.s_addr)) {
memcpy( &list[count++], &nics[i].iface_addr.ip, sizeof( struct in_addr ) );
}
}
diff --git a/source3/utils/netlookup.c b/source3/utils/netlookup.c
index 58c0f01019..998e77c68e 100644
--- a/source3/utils/netlookup.c
+++ b/source3/utils/netlookup.c
@@ -56,8 +56,9 @@ static int cs_destructor(struct con_struct *p)
static struct con_struct *create_cs(TALLOC_CTX *ctx, NTSTATUS *perr)
{
NTSTATUS nt_status;
- struct in_addr loopback_ip = *interpret_addr2("127.0.0.1");
+ struct in_addr loopback_ip;
+ loopback_ip.s_addr = htonl(INADDR_LOOPBACK);
*perr = NT_STATUS_OK;
if (cs) {
diff --git a/source3/utils/nmblookup.c b/source3/utils/nmblookup.c
index bf158fe4a0..52d7ad1a3c 100644
--- a/source3/utils/nmblookup.c
+++ b/source3/utils/nmblookup.c
@@ -141,11 +141,14 @@ static BOOL query_one(const char *lookup, unsigned int lookup_type)
use_bcast?True:recursion_desired,
bcast_addr,&count, &flags, NULL);
} else {
- struct in_addr *bcast;
+ const struct in_addr *bcast;
for (j=iface_count() - 1;
!ip_list && j >= 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: ");