summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-10-13 20:24:37 +0200
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:43:00 +0100
commitb09047b78e981af8ade6a72d426bfcb0e742995b (patch)
tree2547a72c9814f190d83cb0f8ecac678976a72ff5 /source4
parent8517878144973aa23e653bfc7aabfbaef500c7e2 (diff)
downloadsamba-b09047b78e981af8ade6a72d426bfcb0e742995b.tar.gz
samba-b09047b78e981af8ade6a72d426bfcb0e742995b.tar.bz2
samba-b09047b78e981af8ade6a72d426bfcb0e742995b.zip
r25624: Remove ipv4_addr hack. Only causes 4 extra includes of system/network.h because we stripped down includes.
(This used to be commit 262c1c23a61f1f4fae13e0a61179fe98b682cecf)
Diffstat (limited to 'source4')
-rw-r--r--source4/auth/auth_server.c2
-rw-r--r--source4/client/mount.cifs.c2
-rw-r--r--source4/client/smbmount.c4
-rw-r--r--source4/lib/ldb/include/ldb.h12
-rw-r--r--source4/lib/samba3/samba3.h2
-rw-r--r--source4/lib/samba3/winsdb.c3
-rw-r--r--source4/lib/socket/interface.c45
-rw-r--r--source4/lib/socket/socket_ip.c22
-rw-r--r--source4/lib/tdr/tdr.c8
-rw-r--r--source4/lib/util/system.c13
-rw-r--r--source4/lib/util/util.c18
-rw-r--r--source4/lib/util/util.h18
-rw-r--r--source4/libcli/resolve/host.c4
-rw-r--r--source4/libcli/resolve/resolve.c5
-rw-r--r--source4/librpc/ndr/libndr.h2
-rw-r--r--source4/librpc/ndr/ndr_basic.c8
-rw-r--r--source4/librpc/ndr/ndr_misc.c8
-rw-r--r--source4/nbt_server/interfaces.c2
-rw-r--r--source4/nbt_server/wins/winsserver.c6
-rw-r--r--source4/scripting/ejs/smbcalls_samba3.c3
-rw-r--r--source4/torture/local/resolve.c3
21 files changed, 88 insertions, 102 deletions
diff --git a/source4/auth/auth_server.c b/source4/auth/auth_server.c
index abc052c9ea..b4fbeea2f5 100644
--- a/source4/auth/auth_server.c
+++ b/source4/auth/auth_server.c
@@ -28,7 +28,7 @@ static struct smbcli_state *server_cryptkey(TALLOC_CTX *mem_ctx)
{
struct smbcli_state *cli = NULL;
fstring desthost;
- struct ipv4_addr dest_ip;
+ struct in_addr dest_ip;
const char *p;
char *pserver;
bool connected_ok = false;
diff --git a/source4/client/mount.cifs.c b/source4/client/mount.cifs.c
index 8290403815..7167859d7b 100644
--- a/source4/client/mount.cifs.c
+++ b/source4/client/mount.cifs.c
@@ -197,7 +197,7 @@ char * parse_server(char * unc_name)
char * share;
char * ipaddress_string = NULL;
struct hostent * host_entry;
- struct ipv4_addr server_ipaddr;
+ struct in_addr server_ipaddr;
int rc,j;
char temp[64];
diff --git a/source4/client/smbmount.c b/source4/client/smbmount.c
index 31e7628fcd..8a106974c2 100644
--- a/source4/client/smbmount.c
+++ b/source4/client/smbmount.c
@@ -33,7 +33,7 @@ static pstring mpoint;
static pstring service;
static pstring options;
-static struct ipv4_addr dest_ip;
+static struct in_addr dest_ip;
static bool have_ip;
static int smb_port = 0;
static bool got_user;
@@ -116,7 +116,7 @@ static struct smbcli_state *do_connection(char *the_service)
struct smbcli_state *c;
struct nmb_name called, calling;
char *server_n;
- struct ipv4_addr ip;
+ struct in_addr ip;
pstring server;
char *share;
diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h
index 41d23b5d10..301db4dadc 100644
--- a/source4/lib/ldb/include/ldb.h
+++ b/source4/lib/ldb/include/ldb.h
@@ -735,12 +735,14 @@ struct ldb_register_partition {
struct ldb_dn *dn;
};
+enum ldb_sequence_type {
+ LDB_SEQ_HIGHEST_SEQ,
+ LDB_SEQ_HIGHEST_TIMESTAMP,
+ LDB_SEQ_NEXT
+};
+
struct ldb_sequence_number {
- enum ldb_sequence_type {
- LDB_SEQ_HIGHEST_SEQ,
- LDB_SEQ_HIGHEST_TIMESTAMP,
- LDB_SEQ_NEXT
- } type;
+ enum ldb_sequence_type type;
uint64_t seq_num;
uint32_t flags;
};
diff --git a/source4/lib/samba3/samba3.h b/source4/lib/samba3/samba3.h
index bc73e8941d..202ac767ec 100644
--- a/source4/lib/samba3/samba3.h
+++ b/source4/lib/samba3/samba3.h
@@ -98,7 +98,7 @@ struct samba3_winsdb_entry
int type;
time_t ttl;
uint32_t ip_count;
- struct ipv4_addr *ips;
+ struct in_addr *ips;
};
struct samba3_policy
diff --git a/source4/lib/samba3/winsdb.c b/source4/lib/samba3/winsdb.c
index 0a93dbb0e1..5bed3523ea 100644
--- a/source4/lib/samba3/winsdb.c
+++ b/source4/lib/samba3/winsdb.c
@@ -23,6 +23,7 @@
#include "includes.h"
#include "system/filesys.h"
#include "lib/samba3/samba3.h"
+#include "system/network.h"
#define WINS_VERSION 1
@@ -110,7 +111,7 @@ NTSTATUS samba3_read_winsdb( const char *fn, TALLOC_CTX *ctx, struct samba3_wins
}
/* Allocate the space for the ip_list. */
- if((entry.ips = talloc_array ( ctx, struct ipv4_addr, entry.ip_count)) == NULL) {
+ if((entry.ips = talloc_array ( ctx, struct in_addr, entry.ip_count)) == NULL) {
DEBUG(0,("initialise_wins: Malloc fail !\n"));
SAFE_FREE(line);
return NT_STATUS_NO_MEMORY;
diff --git a/source4/lib/socket/interface.c b/source4/lib/socket/interface.c
index 9ca4450581..c220c4d890 100644
--- a/source4/lib/socket/interface.c
+++ b/source4/lib/socket/interface.c
@@ -28,8 +28,8 @@
/** used for network interfaces */
struct interface {
struct interface *next, *prev;
- struct ipv4_addr ip;
- struct ipv4_addr nmask;
+ struct in_addr ip;
+ struct in_addr nmask;
const char *ip_s;
const char *bcast_s;
const char *nmask_s;
@@ -44,25 +44,18 @@ static struct interface *local_interfaces;
#define MKBCADDR(_IP, _NM) ((_IP & _NM) | (_NM ^ ALLONES))
#define MKNETADDR(_IP, _NM) (_IP & _NM)
-static struct ipv4_addr tov4(struct in_addr in)
-{
- struct ipv4_addr in2;
- in2.addr = in.s_addr;
- return in2;
-}
-
/****************************************************************************
Try and find an interface that matches an ip. If we cannot, return NULL
**************************************************************************/
static struct interface *iface_find(struct in_addr ip, bool CheckMask)
{
struct interface *i;
- if (is_zero_ip(tov4(ip))) return local_interfaces;
+ if (is_zero_ip(ip)) return local_interfaces;
for (i=local_interfaces;i;i=i->next)
if (CheckMask) {
- if (same_net(i->ip,tov4(ip),i->nmask)) return i;
- } else if (i->ip.addr == ip.s_addr) return i;
+ if (same_net(i->ip,ip,i->nmask)) return i;
+ } else if (i->ip.s_addr == ip.s_addr) return i;
return NULL;
}
@@ -74,7 +67,7 @@ add an interface to the linked list of interfaces
static void add_interface(struct in_addr ip, struct in_addr nmask)
{
struct interface *iface;
- struct ipv4_addr bcast;
+ struct in_addr bcast;
if (iface_find(ip, false)) {
DEBUG(3,("not adding duplicate interface %s\n",inet_ntoa(ip)));
@@ -86,17 +79,17 @@ static void add_interface(struct in_addr ip, struct in_addr nmask)
ZERO_STRUCTPN(iface);
- iface->ip = tov4(ip);
- iface->nmask = tov4(nmask);
- bcast.addr = MKBCADDR(iface->ip.addr, iface->nmask.addr);
+ iface->ip = ip;
+ iface->nmask = nmask;
+ bcast.s_addr = MKBCADDR(iface->ip.s_addr, iface->nmask.s_addr);
/* keep string versions too, to avoid people tripping over the implied
- static in sys_inet_ntoa() */
- iface->ip_s = talloc_strdup(iface, sys_inet_ntoa(iface->ip));
- iface->nmask_s = talloc_strdup(iface, sys_inet_ntoa(iface->nmask));
+ static in inet_ntoa() */
+ iface->ip_s = talloc_strdup(iface, inet_ntoa(iface->ip));
+ iface->nmask_s = talloc_strdup(iface, inet_ntoa(iface->nmask));
if (nmask.s_addr != ~0) {
- iface->bcast_s = talloc_strdup(iface, sys_inet_ntoa(bcast));
+ iface->bcast_s = talloc_strdup(iface, inet_ntoa(bcast));
}
DLIST_ADD_END(local_interfaces, iface, struct interface *);
@@ -145,7 +138,7 @@ static void interpret_interface(const char *token,
if (strpbrk(token, "*?") != NULL) {
return;
}
- ip.s_addr = interpret_addr2(token).addr;
+ ip.s_addr = interpret_addr2(token).s_addr;
for (i=0;i<total_probed;i++) {
if (ip.s_addr == probed_ifaces[i].ip.s_addr) {
add_interface(probed_ifaces[i].ip,
@@ -160,10 +153,10 @@ static void interpret_interface(const char *token,
/* parse it into an IP address/netmasklength pair */
*p++ = 0;
- ip.s_addr = interpret_addr2(token).addr;
+ ip.s_addr = interpret_addr2(token).s_addr;
if (strlen(p) > 2) {
- nmask.s_addr = interpret_addr2(p).addr;
+ nmask.s_addr = interpret_addr2(p).s_addr;
} else {
nmask.s_addr = htonl(((ALLONES >> atoi(p)) ^ ALLONES));
}
@@ -172,7 +165,7 @@ static void interpret_interface(const char *token,
if (ip.s_addr == MKBCADDR(ip.s_addr, nmask.s_addr) ||
ip.s_addr == MKNETADDR(ip.s_addr, nmask.s_addr)) {
for (i=0;i<total_probed;i++) {
- if (same_net(tov4(ip), tov4(probed_ifaces[i].ip), tov4(nmask))) {
+ if (same_net(ip, probed_ifaces[i].ip, nmask)) {
add_interface(probed_ifaces[i].ip, nmask);
return;
}
@@ -193,7 +186,7 @@ static void load_interfaces(void)
const char **ptr;
int i;
struct iface_struct ifaces[MAX_INTERFACES];
- struct ipv4_addr loopback_ip;
+ struct in_addr loopback_ip;
int total_probed;
if (local_interfaces != NULL) {
@@ -213,7 +206,7 @@ static void load_interfaces(void)
DEBUG(0,("ERROR: Could not determine network interfaces, you must use a interfaces config line\n"));
}
for (i=0;i<total_probed;i++) {
- if (ifaces[i].ip.s_addr != loopback_ip.addr) {
+ if (ifaces[i].ip.s_addr != loopback_ip.s_addr) {
add_interface(ifaces[i].ip,
ifaces[i].netmask);
}
diff --git a/source4/lib/socket/socket_ip.c b/source4/lib/socket/socket_ip.c
index 499dc93d7b..e3676ad71a 100644
--- a/source4/lib/socket/socket_ip.c
+++ b/source4/lib/socket/socket_ip.c
@@ -91,8 +91,8 @@ static NTSTATUS ipv4_connect(struct socket_context *sock,
uint32_t flags)
{
struct sockaddr_in srv_addr;
- struct ipv4_addr my_ip;
- struct ipv4_addr srv_ip;
+ struct in_addr my_ip;
+ struct in_addr srv_ip;
int ret;
if (my_address && my_address->sockaddr) {
@@ -103,13 +103,13 @@ static NTSTATUS ipv4_connect(struct socket_context *sock,
} else if (my_address) {
my_ip = interpret_addr2(my_address->addr);
- if (my_ip.addr != 0 || my_address->port != 0) {
+ if (my_ip.s_addr != 0 || my_address->port != 0) {
struct sockaddr_in my_addr;
ZERO_STRUCT(my_addr);
#ifdef HAVE_SOCK_SIN_LEN
my_addr.sin_len = sizeof(my_addr);
#endif
- my_addr.sin_addr.s_addr = my_ip.addr;
+ my_addr.sin_addr.s_addr = my_ip.s_addr;
my_addr.sin_port = htons(my_address->port);
my_addr.sin_family = PF_INET;
@@ -127,7 +127,7 @@ static NTSTATUS ipv4_connect(struct socket_context *sock,
}
} else {
srv_ip = interpret_addr2(srv_address->addr);
- if (!srv_ip.addr) {
+ if (!srv_ip.s_addr) {
return NT_STATUS_BAD_NETWORK_NAME;
}
@@ -135,7 +135,7 @@ static NTSTATUS ipv4_connect(struct socket_context *sock,
#ifdef HAVE_SOCK_SIN_LEN
srv_addr.sin_len = sizeof(srv_addr);
#endif
- srv_addr.sin_addr.s_addr= srv_ip.addr;
+ srv_addr.sin_addr.s_addr= srv_ip.s_addr;
srv_addr.sin_port = htons(srv_address->port);
srv_addr.sin_family = PF_INET;
@@ -158,7 +158,7 @@ static NTSTATUS ipv4_listen(struct socket_context *sock,
int queue_size, uint32_t flags)
{
struct sockaddr_in my_addr;
- struct ipv4_addr ip_addr;
+ struct in_addr ip_addr;
int ret;
socket_set_option(sock, "SO_REUSEADDR=1", NULL);
@@ -172,7 +172,7 @@ static NTSTATUS ipv4_listen(struct socket_context *sock,
#ifdef HAVE_SOCK_SIN_LEN
my_addr.sin_len = sizeof(my_addr);
#endif
- my_addr.sin_addr.s_addr = ip_addr.addr;
+ my_addr.sin_addr.s_addr = ip_addr.s_addr;
my_addr.sin_port = htons(my_address->port);
my_addr.sin_family = PF_INET;
@@ -355,17 +355,17 @@ static NTSTATUS ipv4_sendto(struct socket_context *sock,
dest_addr->sockaddr, dest_addr->sockaddrlen);
} else {
struct sockaddr_in srv_addr;
- struct ipv4_addr addr;
+ struct in_addr addr;
ZERO_STRUCT(srv_addr);
#ifdef HAVE_SOCK_SIN_LEN
srv_addr.sin_len = sizeof(srv_addr);
#endif
addr = interpret_addr2(dest_addr->addr);
- if (addr.addr == 0) {
+ if (addr.s_addr == 0) {
return NT_STATUS_HOST_UNREACHABLE;
}
- srv_addr.sin_addr.s_addr = addr.addr;
+ srv_addr.sin_addr.s_addr = addr.s_addr;
srv_addr.sin_port = htons(dest_addr->port);
srv_addr.sin_family = PF_INET;
diff --git a/source4/lib/tdr/tdr.c b/source4/lib/tdr/tdr.c
index 144cfa3e35..8037c6de0a 100644
--- a/source4/lib/tdr/tdr.c
+++ b/source4/lib/tdr/tdr.c
@@ -203,10 +203,10 @@ NTSTATUS tdr_print_charset(struct tdr_print *tdr, const char *name, const char *
NTSTATUS tdr_pull_ipv4address(struct tdr_pull *tdr, TALLOC_CTX *ctx,
const char **address)
{
- struct ipv4_addr in;
- TDR_CHECK(tdr_pull_uint32(tdr, ctx, &in.addr));
- in.addr = htonl(in.addr);
- *address = talloc_strdup(tdr, sys_inet_ntoa(in));
+ struct in_addr in;
+ TDR_CHECK(tdr_pull_uint32(tdr, ctx, &in.s_addr));
+ in.s_addr = htonl(in.s_addr);
+ *address = talloc_strdup(tdr, inet_ntoa(in));
NT_STATUS_HAVE_NO_MEMORY(*address);
return NT_STATUS_OK;
}
diff --git a/source4/lib/util/system.c b/source4/lib/util/system.c
index 1ebc6e7e0f..9bd1800233 100644
--- a/source4/lib/util/system.c
+++ b/source4/lib/util/system.c
@@ -79,19 +79,12 @@ _PUBLIC_ struct hostent *sys_gethostbyname(const char *name)
#endif /* REDUCE_ROOT_DNS_LOOKUPS */
}
-_PUBLIC_ const char *sys_inet_ntoa(struct ipv4_addr in)
-{
- struct in_addr in2;
- in2.s_addr = in.addr;
- return inet_ntoa(in2);
-}
-
-_PUBLIC_ struct ipv4_addr sys_inet_makeaddr(int net, int host)
+_PUBLIC_ struct in_addr sys_inet_makeaddr(int net, int host)
{
struct in_addr in;
- struct ipv4_addr in2;
+ struct in_addr in2;
in = inet_makeaddr(net, host);
- in2.addr = in.s_addr;
+ in2.s_addr = in.s_addr;
return in2;
}
diff --git a/source4/lib/util/util.c b/source4/lib/util/util.c
index 624315f99e..2a2813f9af 100644
--- a/source4/lib/util/util.c
+++ b/source4/lib/util/util.c
@@ -285,11 +285,11 @@ _PUBLIC_ uint32_t interpret_addr(const char *str)
/**
A convenient addition to interpret_addr().
**/
-_PUBLIC_ struct ipv4_addr interpret_addr2(const char *str)
+_PUBLIC_ struct in_addr interpret_addr2(const char *str)
{
- struct ipv4_addr ret;
+ struct in_addr ret;
uint32_t a = interpret_addr(str);
- ret.addr = a;
+ ret.s_addr = a;
return ret;
}
@@ -297,22 +297,22 @@ _PUBLIC_ struct ipv4_addr interpret_addr2(const char *str)
Check if an IP is the 0.0.0.0.
**/
-_PUBLIC_ bool is_zero_ip(struct ipv4_addr ip)
+_PUBLIC_ bool is_zero_ip(struct in_addr ip)
{
- return ip.addr == 0;
+ return ip.s_addr == 0;
}
/**
Are two IPs on the same subnet?
**/
-_PUBLIC_ bool same_net(struct ipv4_addr ip1,struct ipv4_addr ip2,struct ipv4_addr mask)
+_PUBLIC_ bool same_net(struct in_addr ip1, struct in_addr ip2, struct in_addr mask)
{
uint32_t net1,net2,nmask;
- nmask = ntohl(mask.addr);
- net1 = ntohl(ip1.addr);
- net2 = ntohl(ip2.addr);
+ nmask = ntohl(mask.s_addr);
+ net1 = ntohl(ip1.s_addr);
+ net2 = ntohl(ip2.s_addr);
return((net1 & nmask) == (net2 & nmask));
}
diff --git a/source4/lib/util/util.h b/source4/lib/util/util.h
index 1960aa6196..71880c1c1a 100644
--- a/source4/lib/util/util.h
+++ b/source4/lib/util/util.h
@@ -254,13 +254,7 @@ void CatchChildLeaveStatus(void);
/* The following definitions come from lib/util/system.c */
-/*
- we use struct ipv4_addr to avoid having to include all the
- system networking headers everywhere
-*/
-struct ipv4_addr {
- uint32_t addr;
-};
+struct in_addr;
/**************************************************************************
A wrapper for gethostbyname() that tries avoids looking up hostnames
@@ -268,8 +262,8 @@ in the root domain, which can cause dial-on-demand links to come up for no
apparent reason.
****************************************************************************/
_PUBLIC_ struct hostent *sys_gethostbyname(const char *name);
-_PUBLIC_ const char *sys_inet_ntoa(struct ipv4_addr in);
-_PUBLIC_ struct ipv4_addr sys_inet_makeaddr(int net, int host);
+_PUBLIC_ const char *sys_inet_ntoa(struct in_addr in);
+_PUBLIC_ struct in_addr sys_inet_makeaddr(int net, int host);
/* The following definitions come from lib/util/genrand.c */
@@ -676,17 +670,17 @@ _PUBLIC_ uint32_t interpret_addr(const char *str);
/**
A convenient addition to interpret_addr().
**/
-_PUBLIC_ struct ipv4_addr interpret_addr2(const char *str);
+_PUBLIC_ struct in_addr interpret_addr2(const char *str);
/**
Check if an IP is the 0.0.0.0.
**/
-_PUBLIC_ bool is_zero_ip(struct ipv4_addr ip);
+_PUBLIC_ bool is_zero_ip(struct in_addr ip);
/**
Are two IPs on the same subnet?
**/
-_PUBLIC_ bool same_net(struct ipv4_addr ip1,struct ipv4_addr ip2,struct ipv4_addr mask);
+_PUBLIC_ bool same_net(struct in_addr ip1,struct in_addr ip2,struct in_addr mask);
/**
Check if a process exists. Does this work on all unixes?
diff --git a/source4/libcli/resolve/host.c b/source4/libcli/resolve/host.c
index ec394309ef..e98bbc51b2 100644
--- a/source4/libcli/resolve/host.c
+++ b/source4/libcli/resolve/host.c
@@ -65,14 +65,14 @@ static int host_destructor(struct host_state *state)
static void run_child(struct composite_context *c, int fd)
{
struct host_state *state = talloc_get_type(c->private_data, struct host_state);
- struct ipv4_addr ip;
+ struct in_addr ip;
const char *address;
/* this is the blocking call we are going to lots of trouble
to avoid in the parent */
ip = interpret_addr2(state->name.name);
- address = sys_inet_ntoa(ip);
+ address = inet_ntoa(ip);
if (address != NULL) {
write(fd, address, strlen(address)+1);
}
diff --git a/source4/libcli/resolve/resolve.c b/source4/libcli/resolve/resolve.c
index 02e1fbdc04..24113db9f0 100644
--- a/source4/libcli/resolve/resolve.c
+++ b/source4/libcli/resolve/resolve.c
@@ -25,6 +25,7 @@
#include "libcli/resolve/resolve.h"
#include "librpc/gen_ndr/ndr_nbt.h"
#include "param/param.h"
+#include "system/network.h"
struct resolve_state {
struct nbt_name name;
@@ -151,8 +152,8 @@ struct composite_context *resolve_name_send(struct nbt_name *name, struct event_
if (is_ipaddress(state->name.name) ||
strcasecmp(state->name.name, "localhost") == 0) {
- struct ipv4_addr ip = interpret_addr2(state->name.name);
- state->reply_addr = talloc_strdup(state, sys_inet_ntoa(ip));
+ struct in_addr ip = interpret_addr2(state->name.name);
+ state->reply_addr = talloc_strdup(state, inet_ntoa(ip));
if (composite_nomem(state->reply_addr, c)) return c;
composite_done(c);
return c;
diff --git a/source4/librpc/ndr/libndr.h b/source4/librpc/ndr/libndr.h
index d110a25aeb..64d5da44f9 100644
--- a/source4/librpc/ndr/libndr.h
+++ b/source4/librpc/ndr/libndr.h
@@ -329,7 +329,7 @@ NTSTATUS ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, const struct do
NTSTATUS ndr_pull_dom_sid28(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid);
void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct dom_sid *sid);
size_t ndr_size_dom_sid28(const struct dom_sid *sid, int flags);
-void ndr_print_ipv4_addr(struct ndr_print *ndr, const char *name, const struct ipv4_addr *_ip);
+void ndr_print_ipv4_addr(struct ndr_print *ndr, const char *name, const struct in_addr *_ip);
void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid);
#endif /* __LIBNDR_H__ */
diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c
index c0a021e677..a26b67af22 100644
--- a/source4/librpc/ndr/ndr_basic.c
+++ b/source4/librpc/ndr/ndr_basic.c
@@ -585,10 +585,10 @@ _PUBLIC_ NTSTATUS ndr_pull_time_t(struct ndr_pull *ndr, int ndr_flags, time_t *t
*/
_PUBLIC_ NTSTATUS ndr_pull_ipv4address(struct ndr_pull *ndr, int ndr_flags, const char **address)
{
- struct ipv4_addr in;
- NDR_CHECK(ndr_pull_uint32(ndr, ndr_flags, &in.addr));
- in.addr = htonl(in.addr);
- *address = talloc_strdup(ndr->current_mem_ctx, sys_inet_ntoa(in));
+ struct in_addr in;
+ NDR_CHECK(ndr_pull_uint32(ndr, ndr_flags, &in.s_addr));
+ in.s_addr = htonl(in.s_addr);
+ *address = talloc_strdup(ndr->current_mem_ctx, inet_ntoa(in));
NT_STATUS_HAVE_NO_MEMORY(*address);
return NT_STATUS_OK;
}
diff --git a/source4/librpc/ndr/ndr_misc.c b/source4/librpc/ndr/ndr_misc.c
index a3d34643a1..be7dab93d2 100644
--- a/source4/librpc/ndr/ndr_misc.c
+++ b/source4/librpc/ndr/ndr_misc.c
@@ -24,13 +24,13 @@
#include "system/network.h"
#include "librpc/ndr/libndr.h"
-_PUBLIC_ void ndr_print_ipv4_addr(struct ndr_print *ndr, const char *name, const struct ipv4_addr *_ip)
+_PUBLIC_ void ndr_print_in_addr(struct ndr_print *ndr, const char *name, const struct in_addr *_ip)
{
- struct ipv4_addr ip;
+ struct in_addr ip;
- ip.addr = htonl(_ip->addr);
+ ip.s_addr = htonl(_ip->s_addr);
- ndr->print(ndr, "%-25s: %s", name, sys_inet_ntoa(ip));
+ ndr->print(ndr, "%-25s: %s", name, inet_ntoa(ip));
}
_PUBLIC_ void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid)
diff --git a/source4/nbt_server/interfaces.c b/source4/nbt_server/interfaces.c
index f2a875142a..2f51cc3dec 100644
--- a/source4/nbt_server/interfaces.c
+++ b/source4/nbt_server/interfaces.c
@@ -233,7 +233,7 @@ NTSTATUS nbtd_startup_interfaces(struct nbtd_server *nbtsrv)
if (num_interfaces > 0) {
primary_address = iface_n_ip(0);
} else {
- primary_address = sys_inet_ntoa(interpret_addr2(
+ primary_address = inet_ntoa(interpret_addr2(
lp_netbios_name(global_loadparm)));
}
primary_address = talloc_strdup(tmp_ctx, primary_address);
diff --git a/source4/nbt_server/wins/winsserver.c b/source4/nbt_server/wins/winsserver.c
index 2ff5e3f69b..bce80702df 100644
--- a/source4/nbt_server/wins/winsserver.c
+++ b/source4/nbt_server/wins/winsserver.c
@@ -560,13 +560,13 @@ done:
nbtd_name_registration_reply(nbtsock, packet, src, rcode);
}
-static uint32_t ipv4_match_bits(struct ipv4_addr ip1,struct ipv4_addr ip2)
+static uint32_t ipv4_match_bits(struct in_addr ip1, struct in_addr ip2)
{
uint32_t i, j, match=0;
uint8_t *p1, *p2;
- p1 = (uint8_t *)&ip1.addr;
- p2 = (uint8_t *)&ip2.addr;
+ p1 = (uint8_t *)&ip1.s_addr;
+ p2 = (uint8_t *)&ip2.s_addr;
for (i=0; i<4; i++) {
if (p1[i] != p2[i]) break;
diff --git a/source4/scripting/ejs/smbcalls_samba3.c b/source4/scripting/ejs/smbcalls_samba3.c
index 7c9ef50cf5..36ec2a54e4 100644
--- a/source4/scripting/ejs/smbcalls_samba3.c
+++ b/source4/scripting/ejs/smbcalls_samba3.c
@@ -25,6 +25,7 @@
#include "lib/samba3/samba3.h"
#include "libcli/security/security.h"
#include "librpc/gen_ndr/ndr_misc.h"
+#include "system/network.h"
static struct MprVar mprRegistry(struct samba3_regdb *reg)
@@ -407,7 +408,7 @@ static struct MprVar mprWinsEntries(struct samba3 *samba3)
for (j = 0; j < samba3->winsdb_entries[i].ip_count; j++) {
const char *addr;
- addr = sys_inet_ntoa(samba3->winsdb_entries[i].ips[j]);
+ addr = inet_ntoa(samba3->winsdb_entries[i].ips[j]);
mprAddArray(&ips, j, mprString(addr));
}
diff --git a/source4/torture/local/resolve.c b/source4/torture/local/resolve.c
index 9b8050eac1..b87b59b81a 100644
--- a/source4/torture/local/resolve.c
+++ b/source4/torture/local/resolve.c
@@ -23,6 +23,7 @@
#include "lib/events/events.h"
#include "libcli/resolve/resolve.h"
#include "torture/torture.h"
+#include "system/network.h"
static bool test_async_resolve(struct torture_context *tctx)
{
@@ -68,7 +69,7 @@ static bool test_sync_resolve(struct torture_context *tctx)
torture_comment(tctx, "Testing sync resolve of '%s' for %d seconds\n",
host, timelimit);
while (timeval_elapsed(&tv) < timelimit) {
- sys_inet_ntoa(interpret_addr2(host));
+ inet_ntoa(interpret_addr2(host));
count++;
}