summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-10-23 19:53:15 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-10-23 19:53:15 +0200
commitd6a5476ee7af464a381bbeeec576ee58f3650a43 (patch)
treec19d8dab5fe71ad76f3d0f7698afc1300bf3443c
parent55fd6b125c3e5ac135d124c291f5ae6102fcbb2f (diff)
downloadsamba-d6a5476ee7af464a381bbeeec576ee58f3650a43.tar.gz
samba-d6a5476ee7af464a381bbeeec576ee58f3650a43.tar.bz2
samba-d6a5476ee7af464a381bbeeec576ee58f3650a43.zip
Use sockaddr_storage only where we rely on the size, use sockaddr
otherwise (to clarify we can also pass in structs smaller than sockaddr_storage, such as sockaddr_in).
-rw-r--r--source3/auth/auth_server.c2
-rw-r--r--source3/include/proto.h28
-rw-r--r--source3/lib/access.c2
-rw-r--r--source3/lib/interface.c41
-rw-r--r--source3/lib/util_sock.c89
-rw-r--r--source3/libads/kerberos.c9
-rw-r--r--source3/libsmb/cliconnect.c2
-rw-r--r--source3/libsmb/dsgetdcname.c2
-rw-r--r--source3/libsmb/namequery.c36
-rw-r--r--source3/libsmb/namequery_dc.c2
-rw-r--r--source3/nmbd/nmbd.c4
-rw-r--r--source3/nmbd/nmbd_packets.c2
-rw-r--r--source3/nmbd/nmbd_processlogon.c2
-rw-r--r--source3/nmbd/nmbd_subnetdb.c2
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c4
-rw-r--r--source3/utils/net_util.c4
-rw-r--r--source3/winbindd/winbindd_cm.c2
17 files changed, 118 insertions, 115 deletions
diff --git a/source3/auth/auth_server.c b/source3/auth/auth_server.c
index 696b42621e..e74e3f5b3b 100644
--- a/source3/auth/auth_server.c
+++ b/source3/auth/auth_server.c
@@ -65,7 +65,7 @@ static struct cli_state *server_cryptkey(TALLOC_CTX *mem_ctx)
continue;
}
- if (ismyaddr(&dest_ss)) {
+ if (ismyaddr((struct sockaddr *)&dest_ss)) {
DEBUG(1,("Password server loop - disabling password server %s\n",desthost));
continue;
}
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 37f934abc7..96389802f6 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -591,10 +591,10 @@ int smb_iconv_close (smb_iconv_t cd);
/* The following definitions come from lib/interface.c */
-bool ismyaddr(const struct sockaddr_storage *ip);
+bool ismyaddr(const struct sockaddr *ip);
bool ismyip_v4(struct in_addr ip);
-bool is_local_net(const struct sockaddr_storage *from);
-void setup_linklocal_scope_id(struct sockaddr_storage *pss);
+bool is_local_net(const struct sockaddr *from);
+void setup_linklocal_scope_id(struct sockaddr *pss);
bool is_local_net_v4(struct in_addr from);
int iface_count(void);
int iface_count_v4_nl(void);
@@ -604,8 +604,8 @@ const struct sockaddr_storage *iface_n_sockaddr_storage(int n);
const struct in_addr *iface_n_ip_v4(int n);
const struct in_addr *iface_n_bcast_v4(int n);
const struct sockaddr_storage *iface_n_bcast(int n);
-const struct sockaddr_storage *iface_ip(const struct sockaddr_storage *ip);
-bool iface_local(const struct sockaddr_storage *ip);
+const struct sockaddr_storage *iface_ip(const struct sockaddr *ip);
+bool iface_local(const struct sockaddr *ip);
void load_interfaces(void);
void gfree_interfaces(void);
bool interfaces_changed(void);
@@ -1478,27 +1478,27 @@ NTSTATUS sid_array_from_info3(TALLOC_CTX *mem_ctx,
bool is_ipaddress_v4(const char *str);
bool is_ipaddress(const char *str);
-bool is_broadcast_addr(const struct sockaddr_storage *pss);
+bool is_broadcast_addr(const struct sockaddr *pss);
uint32 interpret_addr(const char *str);
struct in_addr *interpret_addr2(struct in_addr *ip, const char *str);
bool interpret_string_addr(struct sockaddr_storage *pss,
const char *str,
int flags);
bool is_loopback_ip_v4(struct in_addr ip);
-bool is_loopback_addr(const struct sockaddr_storage *pss);
+bool is_loopback_addr(const struct sockaddr *pss);
bool is_zero_ip_v4(struct in_addr ip);
-bool is_zero_addr(const struct sockaddr_storage *pss);
+bool is_zero_addr(const struct sockaddr *pss);
void zero_ip_v4(struct in_addr *ip);
void zero_addr(struct sockaddr_storage *pss);
bool same_net_v4(struct in_addr ip1,struct in_addr ip2,struct in_addr mask);
void in_addr_to_sockaddr_storage(struct sockaddr_storage *ss,
struct in_addr ip);
-bool same_net(const struct sockaddr_storage *ip1,
- const struct sockaddr_storage *ip2,
- const struct sockaddr_storage *mask);
-bool addr_equal(const struct sockaddr_storage *ip1,
- const struct sockaddr_storage *ip2);
-bool is_address_any(const struct sockaddr_storage *psa);
+bool same_net(const struct sockaddr *ip1,
+ const struct sockaddr *ip2,
+ const struct sockaddr *mask);
+bool addr_equal(const struct sockaddr *ip1,
+ const struct sockaddr *ip2);
+bool is_address_any(const struct sockaddr *psa);
uint16_t get_sockaddr_port(const struct sockaddr_storage *pss);
char *print_sockaddr(char *dest,
size_t destlen,
diff --git a/source3/lib/access.c b/source3/lib/access.c
index 966d8ce87c..0b09e83ce3 100644
--- a/source3/lib/access.c
+++ b/source3/lib/access.c
@@ -66,7 +66,7 @@ static bool masked_match(const char *tok, const char *slash, const char *s)
}
}
- return same_net(&ss_host, &ss_tok, &ss_mask);
+ return same_net((struct sockaddr *)&ss_host, (struct sockaddr *)&ss_tok, (struct sockaddr *)&ss_mask);
}
/* string_match - match string s against token tok */
diff --git a/source3/lib/interface.c b/source3/lib/interface.c
index 2e7c2706a0..4536990d28 100644
--- a/source3/lib/interface.c
+++ b/source3/lib/interface.c
@@ -29,11 +29,11 @@ static struct interface *local_interfaces;
Check if an IP is one of mine.
**************************************************************************/
-bool ismyaddr(const struct sockaddr_storage *ip)
+bool ismyaddr(const struct sockaddr *ip)
{
struct interface *i;
for (i=local_interfaces;i;i=i->next) {
- if (addr_equal(&i->ip,ip)) {
+ if (addr_equal((struct sockaddr *)&i->ip,ip)) {
return true;
}
}
@@ -44,14 +44,14 @@ bool ismyip_v4(struct in_addr ip)
{
struct sockaddr_storage ss;
in_addr_to_sockaddr_storage(&ss, ip);
- return ismyaddr(&ss);
+ return ismyaddr((struct sockaddr *)&ss);
}
/****************************************************************************
Try and find an interface that matches an ip. If we cannot, return NULL.
**************************************************************************/
-static struct interface *iface_find(const struct sockaddr_storage *ip,
+static struct interface *iface_find(const struct sockaddr *ip,
bool check_mask)
{
struct interface *i;
@@ -62,10 +62,10 @@ static struct interface *iface_find(const struct sockaddr_storage *ip,
for (i=local_interfaces;i;i=i->next) {
if (check_mask) {
- if (same_net(ip, &i->ip, &i->netmask)) {
+ if (same_net(ip, (struct sockaddr *)&i->ip, (struct sockaddr *)&i->netmask)) {
return i;
}
- } else if (addr_equal(&i->ip, ip)) {
+ } else if (addr_equal((struct sockaddr *)&i->ip, ip)) {
return i;
}
}
@@ -77,11 +77,11 @@ static struct interface *iface_find(const struct sockaddr_storage *ip,
Check if a packet is from a local (known) net.
**************************************************************************/
-bool is_local_net(const struct sockaddr_storage *from)
+bool is_local_net(const struct sockaddr *from)
{
struct interface *i;
for (i=local_interfaces;i;i=i->next) {
- if (same_net(from, &i->ip, &i->netmask)) {
+ if (same_net(from, (struct sockaddr *)&i->ip, (struct sockaddr *)&i->netmask)) {
return true;
}
}
@@ -89,11 +89,11 @@ bool is_local_net(const struct sockaddr_storage *from)
}
#if defined(HAVE_IPV6)
-void setup_linklocal_scope_id(struct sockaddr_storage *pss)
+void setup_linklocal_scope_id(struct sockaddr *pss)
{
struct interface *i;
for (i=local_interfaces;i;i=i->next) {
- if (addr_equal(&i->ip,pss)) {
+ if (addr_equal((struct sockaddr *)&i->ip,pss)) {
struct sockaddr_in6 *psa6 =
(struct sockaddr_in6 *)pss;
psa6->sin6_scope_id = if_nametoindex(i->name);
@@ -112,7 +112,7 @@ bool is_local_net_v4(struct in_addr from)
struct sockaddr_storage ss;
in_addr_to_sockaddr_storage(&ss, from);
- return is_local_net(&ss);
+ return is_local_net((struct sockaddr *)&ss);
}
/****************************************************************************
@@ -140,7 +140,7 @@ int iface_count_v4_nl(void)
struct interface *i;
for (i=local_interfaces;i;i=i->next) {
- if (is_loopback_addr(&i->ip)) {
+ if (is_loopback_addr((struct sockaddr *)&i->ip)) {
continue;
}
if (i->ip.ss_family == AF_INET) {
@@ -265,7 +265,7 @@ const struct sockaddr_storage *iface_n_bcast(int n)
an appropriate interface they return the requested field of the
first known interface. */
-const struct sockaddr_storage *iface_ip(const struct sockaddr_storage *ip)
+const struct sockaddr_storage *iface_ip(const struct sockaddr *ip)
{
struct interface *i = iface_find(ip, true);
if (i) {
@@ -276,7 +276,7 @@ const struct sockaddr_storage *iface_ip(const struct sockaddr_storage *ip)
* matching address family. */
for (i=local_interfaces;i;i=i->next) {
- if (i->ip.ss_family == ip->ss_family) {
+ if (i->ip.ss_family == ip->sa_family) {
return &i->ip;
}
}
@@ -287,7 +287,7 @@ const struct sockaddr_storage *iface_ip(const struct sockaddr_storage *ip)
return True if a IP is directly reachable on one of our interfaces
*/
-bool iface_local(const struct sockaddr_storage *ip)
+bool iface_local(const struct sockaddr *ip)
{
return iface_find(ip, True) ? true : false;
}
@@ -301,7 +301,7 @@ static void add_interface(const struct iface_struct *ifs)
char addr[INET6_ADDRSTRLEN];
struct interface *iface;
- if (iface_find(&ifs->ip, False)) {
+ if (iface_find((struct sockaddr *)&ifs->ip, False)) {
DEBUG(3,("add_interface: not adding duplicate interface %s\n",
print_sockaddr(addr, sizeof(addr), &ifs->ip) ));
return;
@@ -388,7 +388,7 @@ static void interpret_interface(char *token)
}
for (i=0;i<total_probed;i++) {
- if (addr_equal(&ss, &probed_ifaces[i].ip)) {
+ if (addr_equal((struct sockaddr *)&ss, (struct sockaddr *)&probed_ifaces[i].ip)) {
add_interface(&probed_ifaces[i]);
return;
}
@@ -441,9 +441,12 @@ static void interpret_interface(char *token)
make_net(&ss_net, &ss, &ss_mask);
/* Maybe the first component was a broadcast address. */
- if (addr_equal(&ss_bcast, &ss) || addr_equal(&ss_net, &ss)) {
+ if (addr_equal((struct sockaddr *)&ss_bcast, (struct sockaddr *)&ss) ||
+ addr_equal((struct sockaddr *)&ss_net, (struct sockaddr *)&ss)) {
for (i=0;i<total_probed;i++) {
- if (same_net(&ss, &probed_ifaces[i].ip, &ss_mask)) {
+ if (same_net((struct sockaddr *)&ss,
+ (struct sockaddr *)&probed_ifaces[i].ip,
+ (struct sockaddr *)&ss_mask)) {
/* Temporarily replace netmask on
* the detected interface - user knows
* best.... */
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index f3dc3fc1d1..d6677e2598 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -73,19 +73,19 @@ bool is_ipaddress(const char *str)
}
/****************************************************************************
- Is a sockaddr_storage a broadcast address ?
+ Is a sockaddr a broadcast address ?
****************************************************************************/
-bool is_broadcast_addr(const struct sockaddr_storage *pss)
+bool is_broadcast_addr(const struct sockaddr *pss)
{
#if defined(HAVE_IPV6)
- if (pss->ss_family == AF_INET6) {
+ if (pss->sa_family == AF_INET6) {
const struct in6_addr *sin6 =
&((const struct sockaddr_in6 *)pss)->sin6_addr;
return IN6_IS_ADDR_MULTICAST(sin6);
}
#endif
- if (pss->ss_family == AF_INET) {
+ if (pss->sa_family == AF_INET) {
uint32_t addr =
ntohl(((const struct sockaddr_in *)pss)->sin_addr.s_addr);
return addr == INADDR_BROADCAST;
@@ -271,19 +271,19 @@ bool is_loopback_ip_v4(struct in_addr ip)
}
/*******************************************************************
- Check if a struct sockaddr_storage is the loopback address.
+ Check if a struct sockaddr is the loopback address.
******************************************************************/
-bool is_loopback_addr(const struct sockaddr_storage *pss)
+bool is_loopback_addr(const struct sockaddr *pss)
{
#if defined(HAVE_IPV6)
- if (pss->ss_family == AF_INET6) {
+ if (pss->sa_family == AF_INET6) {
struct in6_addr *pin6 =
&((struct sockaddr_in6 *)pss)->sin6_addr;
return IN6_IS_ADDR_LOOPBACK(pin6);
}
#endif
- if (pss->ss_family == AF_INET) {
+ if (pss->sa_family == AF_INET) {
struct in_addr *pin = &((struct sockaddr_in *)pss)->sin_addr;
return is_loopback_ip_v4(*pin);
}
@@ -302,19 +302,19 @@ bool is_zero_ip_v4(struct in_addr ip)
}
/*******************************************************************
- Check if a struct sockaddr_storage has an unspecified address.
+ Check if a struct sockaddr has an unspecified address.
******************************************************************/
-bool is_zero_addr(const struct sockaddr_storage *pss)
+bool is_zero_addr(const struct sockaddr *pss)
{
#if defined(HAVE_IPV6)
- if (pss->ss_family == AF_INET6) {
+ if (pss->sa_family == AF_INET6) {
struct in6_addr *pin6 =
&((struct sockaddr_in6 *)pss)->sin6_addr;
return IN6_IS_ADDR_UNSPECIFIED(pin6);
}
#endif
- if (pss->ss_family == AF_INET) {
+ if (pss->sa_family == AF_INET) {
struct in_addr *pin = &((struct sockaddr_in *)pss)->sin_addr;
return is_zero_ip_v4(*pin);
}
@@ -388,17 +388,17 @@ void in_addr_to_sockaddr_storage(struct sockaddr_storage *ss,
Are two IPs on the same subnet?
********************************************************************/
-bool same_net(const struct sockaddr_storage *ip1,
- const struct sockaddr_storage *ip2,
- const struct sockaddr_storage *mask)
+bool same_net(const struct sockaddr *ip1,
+ const struct sockaddr *ip2,
+ const struct sockaddr *mask)
{
- if (ip1->ss_family != ip2->ss_family) {
+ if (ip1->sa_family != ip2->sa_family) {
/* Never on the same net. */
return false;
}
#if defined(HAVE_IPV6)
- if (ip1->ss_family == AF_INET6) {
+ if (ip1->sa_family == AF_INET6) {
struct sockaddr_in6 ip1_6 = *(struct sockaddr_in6 *)ip1;
struct sockaddr_in6 ip2_6 = *(struct sockaddr_in6 *)ip2;
struct sockaddr_in6 mask_6 = *(struct sockaddr_in6 *)mask;
@@ -417,7 +417,7 @@ bool same_net(const struct sockaddr_storage *ip1,
sizeof(struct in6_addr)) == 0);
}
#endif
- if (ip1->ss_family == AF_INET) {
+ if (ip1->sa_family == AF_INET) {
return same_net_v4(((const struct sockaddr_in *)ip1)->sin_addr,
((const struct sockaddr_in *)ip2)->sin_addr,
((const struct sockaddr_in *)mask)->sin_addr);
@@ -426,25 +426,25 @@ bool same_net(const struct sockaddr_storage *ip1,
}
/*******************************************************************
- Are two sockaddr_storage's the same family and address ? Ignore port etc.
+ Are two sockaddr 's the same family and address ? Ignore port etc.
********************************************************************/
-bool addr_equal(const struct sockaddr_storage *ip1,
- const struct sockaddr_storage *ip2)
+bool addr_equal(const struct sockaddr *ip1,
+ const struct sockaddr *ip2)
{
- if (ip1->ss_family != ip2->ss_family) {
+ if (ip1->sa_family != ip2->sa_family) {
/* Never the same. */
return false;
}
#if defined(HAVE_IPV6)
- if (ip1->ss_family == AF_INET6) {
+ if (ip1->sa_family == AF_INET6) {
return (memcmp(&((const struct sockaddr_in6 *)ip1)->sin6_addr,
&((const struct sockaddr_in6 *)ip2)->sin6_addr,
sizeof(struct in6_addr)) == 0);
}
#endif
- if (ip1->ss_family == AF_INET) {
+ if (ip1->sa_family == AF_INET) {
return (memcmp(&((const struct sockaddr_in *)ip1)->sin_addr,
&((const struct sockaddr_in *)ip2)->sin_addr,
sizeof(struct in_addr)) == 0);
@@ -456,10 +456,10 @@ bool addr_equal(const struct sockaddr_storage *ip1,
Is an IP address the INADDR_ANY or in6addr_any value ?
****************************************************************************/
-bool is_address_any(const struct sockaddr_storage *psa)
+bool is_address_any(const struct sockaddr *psa)
{
#if defined(HAVE_IPV6)
- if (psa->ss_family == AF_INET6) {
+ if (psa->sa_family == AF_INET6) {
struct sockaddr_in6 *si6 = (struct sockaddr_in6 *)psa;
if (memcmp(&in6addr_any,
&si6->sin6_addr,
@@ -469,7 +469,7 @@ bool is_address_any(const struct sockaddr_storage *psa)
return false;
}
#endif
- if (psa->ss_family == AF_INET) {
+ if (psa->sa_family == AF_INET) {
struct sockaddr_in *si = (struct sockaddr_in *)psa;
if (si->sin_addr.s_addr == INADDR_ANY) {
return true;
@@ -508,13 +508,13 @@ uint16_t get_sockaddr_port(const struct sockaddr_storage *pss)
static char *print_sockaddr_len(char *dest,
size_t destlen,
- const struct sockaddr_storage *psa,
+ const struct sockaddr *psa,
socklen_t psalen)
{
if (destlen > 0) {
dest[0] = '\0';
}
- (void)sys_getnameinfo((const struct sockaddr *)psa,
+ (void)sys_getnameinfo(psa,
psalen,
dest, destlen,
NULL, 0,
@@ -530,7 +530,7 @@ char *print_sockaddr(char *dest,
size_t destlen,
const struct sockaddr_storage *psa)
{
- return print_sockaddr_len(dest, destlen, psa,
+ return print_sockaddr_len(dest, destlen, (struct sockaddr *)psa,
sizeof(struct sockaddr_storage));
}
@@ -596,7 +596,7 @@ static const char *get_socket_addr(int fd, char *addr_buf, size_t addr_len)
return addr_buf;
}
- return print_sockaddr_len(addr_buf, addr_len, &sa, length);
+ return print_sockaddr_len(addr_buf, addr_len, (struct sockaddr *)&sa, length);
}
#if 0
@@ -1313,7 +1313,7 @@ int open_socket_out(int type,
psa6->sin6_port = htons(port);
if (psa6->sin6_scope_id == 0 &&
IN6_IS_ADDR_LINKLOCAL(&psa6->sin6_addr)) {
- setup_linklocal_scope_id(&sock_out);
+ setup_linklocal_scope_id((struct sockaddr *)&sock_out);
}
}
#endif
@@ -1583,7 +1583,7 @@ int open_udp_socket(const char *host, int port)
static const char *get_peer_addr_internal(int fd,
char *addr_buf,
size_t addr_buf_len,
- struct sockaddr_storage *pss,
+ struct sockaddr *pss,
socklen_t *plength)
{
struct sockaddr_storage ss;
@@ -1596,9 +1596,7 @@ static const char *get_peer_addr_internal(int fd,
}
if (pss == NULL) {
- pss = &ss;
- }
- if (plength == NULL) {
+ pss = (struct sockaddr *)&ss;
plength = &length;
}
@@ -1621,7 +1619,7 @@ static const char *get_peer_addr_internal(int fd,
******************************************************************/
static bool matchname(const char *remotehost,
- const struct sockaddr_storage *pss,
+ const struct sockaddr *pss,
socklen_t len)
{
struct addrinfo *res = NULL;
@@ -1659,8 +1657,8 @@ static bool matchname(const char *remotehost,
if (!res->ai_addr) {
continue;
}
- if (addr_equal((const struct sockaddr_storage *)res->ai_addr,
- pss)) {
+ if (addr_equal((const struct sockaddr *)res->ai_addr,
+ (struct sockaddr *)pss)) {
freeaddrinfo(ailist);
return true;
}
@@ -1760,7 +1758,7 @@ const char *get_peer_name(int fd, bool force_lookup)
if (!lp_hostname_lookups() && (force_lookup == false)) {
length = sizeof(nc.ss);
nc.name = get_peer_addr_internal(fd, addr_buf, sizeof(addr_buf),
- &nc.ss, &length);
+ (struct sockaddr *)&nc.ss, &length);
store_nc(&nc);
lookup_nc(&nc);
return nc.name ? nc.name : "UNKNOWN";
@@ -1769,10 +1767,10 @@ const char *get_peer_name(int fd, bool force_lookup)
lookup_nc(&nc);
memset(&ss, '\0', sizeof(ss));
- p = get_peer_addr_internal(fd, addr_buf, sizeof(addr_buf), &ss, &length);
+ p = get_peer_addr_internal(fd, addr_buf, sizeof(addr_buf), (struct sockaddr *)&ss, &length);
/* it might be the same as the last one - save some DNS work */
- if (addr_equal(&ss, &nc.ss)) {
+ if (addr_equal((struct sockaddr *)&ss, (struct sockaddr *)&nc.ss)) {
return nc.name ? nc.name : "UNKNOWN";
}
@@ -1797,7 +1795,7 @@ const char *get_peer_name(int fd, bool force_lookup)
gai_strerror(ret)));
strlcpy(name_buf, p, sizeof(name_buf));
} else {
- if (!matchname(name_buf, &ss, length)) {
+ if (!matchname(name_buf, (struct sockaddr *)&ss, length)) {
DEBUG(0,("Matchname failed on %s %s\n",name_buf,p));
strlcpy(name_buf,"UNKNOWN",sizeof(name_buf));
}
@@ -2080,7 +2078,8 @@ bool is_myname_or_ipaddr(const char *s)
return false;
}
- if (is_zero_addr(&ss) || is_loopback_addr(&ss)) {
+ if (is_zero_addr((struct sockaddr *)&ss) ||
+ is_loopback_addr((struct sockaddr *)&ss)) {
return false;
}
@@ -2091,7 +2090,7 @@ bool is_myname_or_ipaddr(const char *s)
}
n = get_interfaces(nics, MAX_INTERFACES);
for (i=0; i<n; i++) {
- if (addr_equal(&nics[i].ip, &ss)) {
+ if (addr_equal((struct sockaddr *)&nics[i].ip, (struct sockaddr *)&ss)) {
TALLOC_FREE(nics);
return true;
}
diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c
index 501ef010fd..4658f66cfd 100644
--- a/source3/libads/kerberos.c
+++ b/source3/libads/kerberos.c
@@ -772,7 +772,8 @@ static char *get_kdc_ip_string(char *mem_ctx,
get_kdc_list(realm, sitename, &ip_srv_site, &count_site);
for (i = 0; i < count_site; i++) {
- if (addr_equal(&ip_srv_site[i].ss, pss)) {
+ if (addr_equal((struct sockaddr *)&ip_srv_site[i].ss,
+ (struct sockaddr *)pss)) {
continue;
}
/* Append to the string - inefficient
@@ -794,14 +795,14 @@ static char *get_kdc_ip_string(char *mem_ctx,
for (i = 0; i < count_nonsite; i++) {
int j;
- if (addr_equal(&ip_srv_nonsite[i].ss, pss)) {
+ if (addr_equal((struct sockaddr *)&ip_srv_nonsite[i].ss, (struct sockaddr *)pss)) {
continue;
}
/* Ensure this isn't an IP already seen (YUK! this is n*n....) */
for (j = 0; j < count_site; j++) {
- if (addr_equal(&ip_srv_nonsite[i].ss,
- &ip_srv_site[j].ss)) {
+ if (addr_equal((struct sockaddr *)&ip_srv_nonsite[i].ss,
+ (struct sockaddr *)&ip_srv_site[j].ss)) {
break;
}
/* As the lists are sorted we can break early if nonsite > site. */
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 1fd6f20d9d..6b4798e492 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -1514,7 +1514,7 @@ NTSTATUS cli_connect(struct cli_state *cli,
*p = 0;
}
- if (!dest_ss || is_zero_addr(dest_ss)) {
+ if (!dest_ss || is_zero_addr((struct sockaddr *)dest_ss)) {
NTSTATUS status =resolve_name_list(frame,
cli->desthost,
name_type,
diff --git a/source3/libsmb/dsgetdcname.c b/source3/libsmb/dsgetdcname.c
index 08ab8cad14..ff0a8f9808 100644
--- a/source3/libsmb/dsgetdcname.c
+++ b/source3/libsmb/dsgetdcname.c
@@ -656,7 +656,7 @@ static NTSTATUS discover_dc_dns(TALLOC_CTX *mem_ctx,
* back to netbios lookups is that our DNS server doesn't know
* anything about the DC's -- jerry */
- if (!is_zero_addr(&r->ss)) {
+ if (!is_zero_addr((struct sockaddr *)&r->ss)) {
count++;
continue;
}
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index 24d7ee1a9c..e6eed8289e 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -381,16 +381,16 @@ bool name_status_find(const char *q_name,
comparison function used by sort_addr_list
*/
-static int addr_compare(const struct sockaddr_storage *ss1,
- const struct sockaddr_storage *ss2)
+static int addr_compare(const struct sockaddr *ss1,
+ const struct sockaddr *ss2)
{
int max_bits1=0, max_bits2=0;
int num_interfaces = iface_count();
int i;
/* Sort IPv6 addresses first. */
- if (ss1->ss_family != ss2->ss_family) {
- if (ss2->ss_family == AF_INET) {
+ if (ss1->sa_family != ss2->sa_family) {
+ if (ss2->sa_family == AF_INET) {
return -1;
} else {
return 1;
@@ -408,7 +408,7 @@ static int addr_compare(const struct sockaddr_storage *ss1,
size_t len = 0;
int bits1, bits2;
- if (pss->ss_family != ss1->ss_family) {
+ if (pss->ss_family != ss1->sa_family) {
/* Ignore interfaces of the wrong type. */
continue;
}
@@ -443,14 +443,14 @@ static int addr_compare(const struct sockaddr_storage *ss1,
/* Bias towards directly reachable IPs */
if (iface_local(ss1)) {
- if (ss1->ss_family == AF_INET) {
+ if (ss1->sa_family == AF_INET) {
max_bits1 += 32;
} else {
max_bits1 += 128;
}
}
if (iface_local(ss2)) {
- if (ss2->ss_family == AF_INET) {
+ if (ss2->sa_family == AF_INET) {
max_bits2 += 32;
} else {
max_bits2 += 128;
@@ -467,7 +467,7 @@ int ip_service_compare(struct ip_service *ss1, struct ip_service *ss2)
{
int result;
- if ((result = addr_compare(&ss1->ss, &ss2->ss)) != 0) {
+ if ((result = addr_compare((struct sockaddr *)&ss1->ss, (struct sockaddr *)&ss2->ss)) != 0) {
return result;
}
@@ -521,12 +521,12 @@ static int remove_duplicate_addrs2(struct ip_service *iplist, int count )
/* one loop to remove duplicates */
for ( i=0; i<count; i++ ) {
- if ( is_zero_addr(&iplist[i].ss)) {
+ if ( is_zero_addr((struct sockaddr *)&iplist[i].ss)) {
continue;
}
for ( j=i+1; j<count; j++ ) {
- if (addr_equal(&iplist[i].ss, &iplist[j].ss) &&
+ if (addr_equal((struct sockaddr *)&iplist[i].ss, (struct sockaddr *)&iplist[j].ss) &&
iplist[i].port == iplist[j].port) {
zero_addr(&iplist[j].ss);
}
@@ -536,7 +536,7 @@ static int remove_duplicate_addrs2(struct ip_service *iplist, int count )
/* one loop to clean up any holes we left */
/* first ip should never be a zero_ip() */
for (i = 0; i<count; ) {
- if (is_zero_addr(&iplist[i].ss) ) {
+ if (is_zero_addr((struct sockaddr *)&iplist[i].ss) ) {
if (i != count-1) {
memmove(&iplist[i], &iplist[i+1],
(count - i - 1)*sizeof(iplist[i]));
@@ -1403,7 +1403,7 @@ static NTSTATUS resolve_ads(const char *name,
* for falling back to netbios lookups is that our DNS server
* doesn't know anything about the DC's -- jerry */
- if (!is_zero_addr(&r->ss)) {
+ if (!is_zero_addr((struct sockaddr *)&r->ss)) {
(*return_count)++;
}
}
@@ -1632,8 +1632,8 @@ bool resolve_name(const char *name,
/* only return valid addresses for TCP connections */
for (i=0; i<count; i++) {
- if (!is_zero_addr(&ss_list[i].ss) &&
- !is_broadcast_addr(&ss_list[i].ss)) {
+ if (!is_zero_addr((struct sockaddr *)&ss_list[i].ss) &&
+ !is_broadcast_addr((struct sockaddr *)&ss_list[i].ss)) {
*return_ss = ss_list[i].ss;
SAFE_FREE(ss_list);
SAFE_FREE(sitename);
@@ -1696,8 +1696,8 @@ NTSTATUS resolve_name_list(TALLOC_CTX *ctx,
/* only return valid addresses for TCP connections */
for (i=0, num_entries = 0; i<count; i++) {
- if (!is_zero_addr(&ss_list[i].ss) &&
- !is_broadcast_addr(&ss_list[i].ss)) {
+ if (!is_zero_addr((struct sockaddr *)&ss_list[i].ss) &&
+ !is_broadcast_addr((struct sockaddr *)&ss_list[i].ss)) {
num_entries++;
}
}
@@ -1715,8 +1715,8 @@ NTSTATUS resolve_name_list(TALLOC_CTX *ctx,
}
for (i=0, num_entries = 0; i<count; i++) {
- if (!is_zero_addr(&ss_list[i].ss) &&
- !is_broadcast_addr(&ss_list[i].ss)) {
+ if (!is_zero_addr((struct sockaddr *)&ss_list[i].ss) &&
+ !is_broadcast_addr((struct sockaddr *)&ss_list[i].ss)) {
(*return_ss_arr)[num_entries++] = ss_list[i].ss;
}
}
diff --git a/source3/libsmb/namequery_dc.c b/source3/libsmb/namequery_dc.c
index d080f8f0b7..306f720a02 100644
--- a/source3/libsmb/namequery_dc.c
+++ b/source3/libsmb/namequery_dc.c
@@ -171,7 +171,7 @@ static bool rpc_dc_name(const char *domain,
/* Remove the entry we've already failed with (should be the PDC). */
for (i = 0; i < count; i++) {
- if (is_zero_addr(&ip_list[i].ss))
+ if (is_zero_addr((struct sockaddr *)&ip_list[i].ss))
continue;
if (name_status_find(domain, 0x1c, 0x20, &ip_list[i].ss, srv_name)) {
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 28de212d69..adc331cc3e 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -219,7 +219,7 @@ static void reload_interfaces(time_t t)
* ignore it here. JRA.
*/
- if (is_loopback_addr(&iface->ip)) {
+ if (is_loopback_addr((struct sockaddr *)&iface->ip)) {
DEBUG(2,("reload_interfaces: Ignoring loopback "
"interface %s\n",
print_sockaddr(str, sizeof(str), &iface->ip) ));
@@ -397,7 +397,7 @@ static void msg_nmbd_send_packet(struct messaging_context *msg,
}
in_addr_to_sockaddr_storage(&ss, p->ip);
- pss = iface_ip(&ss);
+ pss = iface_ip((struct sockaddr *)&ss);
if (pss == NULL) {
DEBUG(2, ("Could not find ip for packet from %d\n",
diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c
index 4b97819a14..66b584ad54 100644
--- a/source3/nmbd/nmbd_packets.c
+++ b/source3/nmbd/nmbd_packets.c
@@ -476,7 +476,7 @@ struct response_record *queue_register_name( struct subnet_record *subrec,
return NULL;
in_addr_to_sockaddr_storage(&ss, subrec->bcast_ip);
- pss = iface_ip(&ss);
+ pss = iface_ip((struct sockaddr *)&ss);
if (!pss || pss->ss_family != AF_INET) {
p->locked = False;
free_packet(p);
diff --git a/source3/nmbd/nmbd_processlogon.c b/source3/nmbd/nmbd_processlogon.c
index 9ee0709cb5..565d81f82d 100644
--- a/source3/nmbd/nmbd_processlogon.c
+++ b/source3/nmbd/nmbd_processlogon.c
@@ -93,7 +93,7 @@ void process_logon_packet(struct packet_struct *p, char *buf,int len,
struct in_addr ip;
in_addr_to_sockaddr_storage(&ss, p->ip);
- pss = iface_ip(&ss);
+ pss = iface_ip((struct sockaddr *)&ss);
if (!pss) {
DEBUG(5,("process_logon_packet:can't find outgoing interface "
"for packet from IP %s\n",
diff --git a/source3/nmbd/nmbd_subnetdb.c b/source3/nmbd/nmbd_subnetdb.c
index 225def52cc..61af0bb4a4 100644
--- a/source3/nmbd/nmbd_subnetdb.c
+++ b/source3/nmbd/nmbd_subnetdb.c
@@ -260,7 +260,7 @@ bool create_subnets(void)
* ignore it here. JRA.
*/
- if (is_loopback_addr(&iface->ip)) {
+ if (is_loopback_addr((struct sockaddr *)&iface->ip)) {
DEBUG(2,("create_subnets: Ignoring loopback interface.\n" ));
continue;
}
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index b0200de20a..cafe9fc9af 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -2573,13 +2573,13 @@ static bool spoolss_connect_to_client(struct rpc_pipe_client **pp_pipe,
struct cli_state *the_cli;
struct sockaddr_storage rm_addr;
- if ( is_zero_addr(client_ss) ) {
+ if ( is_zero_addr((struct sockaddr *)client_ss) ) {
if ( !resolve_name( remote_machine, &rm_addr, 0x20) ) {
DEBUG(2,("spoolss_connect_to_client: Can't resolve address for %s\n", remote_machine));
return False;
}
- if (ismyaddr(&rm_addr)) {
+ if (ismyaddr((struct sockaddr *)&rm_addr)) {
DEBUG(0,("spoolss_connect_to_client: Machine %s is one of our addresses. Cannot add to ourselves.\n", remote_machine));
return False;
}
diff --git a/source3/utils/net_util.c b/source3/utils/net_util.c
index fbb3c24b03..a9b2bbe621 100644
--- a/source3/utils/net_util.c
+++ b/source3/utils/net_util.c
@@ -406,7 +406,7 @@ bool net_find_server(struct net_context *c,
return false;
}
- if (is_zero_addr(&pdc_ss)) {
+ if (is_zero_addr((struct sockaddr *)&pdc_ss)) {
return false;
}
@@ -463,7 +463,7 @@ bool net_find_pdc(struct sockaddr_storage *server_ss,
if (!get_pdc_ip(domain_name, server_ss)) {
return false;
}
- if (is_zero_addr(server_ss)) {
+ if (is_zero_addr((struct sockaddr *)server_ss)) {
return false;
}
diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c
index db43101a34..05c39f8f2b 100644
--- a/source3/winbindd/winbindd_cm.c
+++ b/source3/winbindd/winbindd_cm.c
@@ -1038,7 +1038,7 @@ static bool add_one_dc_unique(TALLOC_CTX *mem_ctx, const char *domain_name,
/* Make sure there's no duplicates in the list */
for (i=0; i<*num; i++)
- if (addr_equal(&(*dcs)[i].ss, pss))
+ if (addr_equal((struct sockaddr *)&(*dcs)[i].ss, (struct sockaddr *)pss))
return False;
*dcs = TALLOC_REALLOC_ARRAY(mem_ctx, *dcs, struct dc_name_ip, (*num)+1);