summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-02-27 09:57:18 +0100
committerVolker Lendecke <vlendec@samba.org>2011-02-27 11:02:53 +0100
commitfec0baacb658eb1bfc15c8ca4dfeecc1cf84eb79 (patch)
tree93055e96b9d02adf9804c69a25f35c0dcf4067b4
parent561205b0166cb4a9c2efbb32b8429f6a83827eee (diff)
downloadsamba-fec0baacb658eb1bfc15c8ca4dfeecc1cf84eb79.tar.gz
samba-fec0baacb658eb1bfc15c8ca4dfeecc1cf84eb79.tar.bz2
samba-fec0baacb658eb1bfc15c8ca4dfeecc1cf84eb79.zip
s3: Make is_zero_addr take a sockaddr_storage
All callers had to cast this anyway Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Sun Feb 27 11:02:53 CET 2011 on sn-devel-104
-rw-r--r--lib/util/util_net.c6
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/lib/util_sock.c2
-rw-r--r--source3/libsmb/cliconnect.c2
-rw-r--r--source3/libsmb/dsgetdcname.c2
-rw-r--r--source3/libsmb/namequery.c14
-rw-r--r--source3/libsmb/namequery_dc.c2
-rw-r--r--source3/rpc_server/spoolss/srv_spoolss_nt.c2
-rw-r--r--source3/utils/net_util.c4
9 files changed, 18 insertions, 18 deletions
diff --git a/lib/util/util_net.c b/lib/util/util_net.c
index 8a9b5b1f24..9c8f5c6d47 100644
--- a/lib/util/util_net.c
+++ b/lib/util/util_net.c
@@ -384,16 +384,16 @@ bool is_loopback_addr(const struct sockaddr *pss)
/**
* Check if a struct sockaddr has an unspecified address.
*/
-bool is_zero_addr(const struct sockaddr *pss)
+bool is_zero_addr(const struct sockaddr_storage *pss)
{
#if defined(HAVE_IPV6)
- if (pss->sa_family == AF_INET6) {
+ if (pss->ss_family == AF_INET6) {
const struct in6_addr *pin6 =
&((const struct sockaddr_in6 *)pss)->sin6_addr;
return IN6_IS_ADDR_UNSPECIFIED(pin6);
}
#endif
- if (pss->sa_family == AF_INET) {
+ if (pss->ss_family == AF_INET) {
const struct in_addr *pin = &((const struct sockaddr_in *)pss)->sin_addr;
return is_zero_ip_v4(*pin);
}
diff --git a/source3/include/proto.h b/source3/include/proto.h
index ae048af19f..fdc2b7b7b5 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1249,7 +1249,7 @@ NTSTATUS sid_array_from_info3(TALLOC_CTX *mem_ctx,
bool is_broadcast_addr(const struct sockaddr *pss);
bool is_loopback_ip_v4(struct in_addr ip);
bool is_loopback_addr(const struct sockaddr *pss);
-bool is_zero_addr(const struct sockaddr *pss);
+bool is_zero_addr(const struct sockaddr_storage *pss);
void zero_ip_v4(struct in_addr *ip);
void in_addr_to_sockaddr_storage(struct sockaddr_storage *ss,
struct in_addr ip);
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index d0ff960a3c..1de6d17a41 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -1666,7 +1666,7 @@ bool is_myname_or_ipaddr(const char *s)
return true;
}
- if (is_zero_addr((struct sockaddr *)&ss) ||
+ if (is_zero_addr(&ss) ||
is_loopback_addr((struct sockaddr *)&ss)) {
return false;
}
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 25df2b2b4e..564cf8b3c7 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -2433,7 +2433,7 @@ NTSTATUS cli_connect(struct cli_state *cli,
*p = 0;
}
- if (!dest_ss || is_zero_addr((struct sockaddr *)dest_ss)) {
+ if (!dest_ss || is_zero_addr(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 cc486c122e..e062818dda 100644
--- a/source3/libsmb/dsgetdcname.c
+++ b/source3/libsmb/dsgetdcname.c
@@ -629,7 +629,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((struct sockaddr *)(void *)&r->ss)) {
+ if (!is_zero_addr(&r->ss)) {
count++;
continue;
}
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index 0da495dbb9..9bc6911942 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -1079,7 +1079,7 @@ 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((struct sockaddr *)&iplist[i].ss)) {
+ if ( is_zero_addr(&iplist[i].ss)) {
continue;
}
@@ -1094,7 +1094,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((struct sockaddr *)&iplist[i].ss) ) {
+ if (is_zero_addr(&iplist[i].ss) ) {
if (i != count-1) {
memmove(&iplist[i], &iplist[i+1],
(count - i - 1)*sizeof(iplist[i]));
@@ -1921,7 +1921,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((struct sockaddr *)&r->ss)) {
+ if (!is_zero_addr(&r->ss)) {
(*return_count)++;
}
}
@@ -2151,7 +2151,7 @@ bool resolve_name(const char *name,
if (prefer_ipv4) {
for (i=0; i<count; i++) {
- if (!is_zero_addr((struct sockaddr *)&ss_list[i].ss) &&
+ if (!is_zero_addr(&ss_list[i].ss) &&
!is_broadcast_addr((struct sockaddr *)&ss_list[i].ss) &&
(ss_list[i].ss.ss_family == AF_INET)) {
*return_ss = ss_list[i].ss;
@@ -2164,7 +2164,7 @@ bool resolve_name(const char *name,
/* only return valid addresses for TCP connections */
for (i=0; i<count; i++) {
- if (!is_zero_addr((struct sockaddr *)&ss_list[i].ss) &&
+ if (!is_zero_addr(&ss_list[i].ss) &&
!is_broadcast_addr((struct sockaddr *)&ss_list[i].ss)) {
*return_ss = ss_list[i].ss;
SAFE_FREE(ss_list);
@@ -2228,7 +2228,7 @@ 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((struct sockaddr *)&ss_list[i].ss) &&
+ if (!is_zero_addr(&ss_list[i].ss) &&
!is_broadcast_addr((struct sockaddr *)&ss_list[i].ss)) {
num_entries++;
}
@@ -2247,7 +2247,7 @@ NTSTATUS resolve_name_list(TALLOC_CTX *ctx,
}
for (i=0, num_entries = 0; i<count; i++) {
- if (!is_zero_addr((struct sockaddr *)&ss_list[i].ss) &&
+ if (!is_zero_addr(&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 23850e3e9f..39b780c611 100644
--- a/source3/libsmb/namequery_dc.c
+++ b/source3/libsmb/namequery_dc.c
@@ -176,7 +176,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((struct sockaddr *)&ip_list[i].ss))
+ if (is_zero_addr(&ip_list[i].ss))
continue;
if (name_status_find(domain, 0x1c, 0x20, &ip_list[i].ss, srv_name)) {
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
index 8d8dd61176..adcc09423d 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
@@ -2490,7 +2490,7 @@ static bool spoolss_connect_to_client(struct rpc_pipe_client **pp_pipe,
struct sockaddr_storage rm_addr;
char addr[INET6_ADDRSTRLEN];
- if ( is_zero_addr((struct sockaddr *)client_ss) ) {
+ if ( is_zero_addr(client_ss) ) {
DEBUG(2,("spoolss_connect_to_client: resolving %s\n",
remote_machine));
if ( !resolve_name( remote_machine, &rm_addr, 0x20, false) ) {
diff --git a/source3/utils/net_util.c b/source3/utils/net_util.c
index 06b3a39edf..67919b37ec 100644
--- a/source3/utils/net_util.c
+++ b/source3/utils/net_util.c
@@ -421,7 +421,7 @@ bool net_find_server(struct net_context *c,
return false;
}
- if (is_zero_addr((struct sockaddr *)&pdc_ss)) {
+ if (is_zero_addr(&pdc_ss)) {
return false;
}
@@ -478,7 +478,7 @@ bool net_find_pdc(struct sockaddr_storage *server_ss,
if (!get_pdc_ip(domain_name, server_ss)) {
return false;
}
- if (is_zero_addr((struct sockaddr *)server_ss)) {
+ if (is_zero_addr(server_ss)) {
return false;
}