From d4307679b95088d05f0abad440de5e961ee965df Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 27 Oct 2007 20:29:36 -0700 Subject: Change all occurrences of zero_addr(&ss,AF_INET) to zero_addr(&ss). All current uses were always of the AF_INET form, so simplify the call. If in the future we need to zero an addr to AF_INET6 this can be done separately. Jeremy. (This used to be commit 2e92418a138bf2738b77b7e0fcb2fa37ad84fc0c) --- source3/client/client.c | 2 +- source3/client/smbmount.c | 2 +- source3/lib/util_sock.c | 8 ++++---- source3/libsmb/cliconnect.c | 2 +- source3/libsmb/clidfs.c | 4 ++-- source3/libsmb/libsmbclient.c | 6 +++--- source3/libsmb/namequery.c | 8 ++++---- source3/libsmb/namequery_dc.c | 4 ++-- source3/rpcclient/rpcclient.c | 2 +- source3/torture/locktest.c | 4 ++-- source3/torture/masktest.c | 4 ++-- source3/torture/torture.c | 2 +- source3/utils/net.c | 2 +- source3/utils/smbcacls.c | 2 +- source3/utils/smbcquotas.c | 2 +- 15 files changed, 27 insertions(+), 27 deletions(-) diff --git a/source3/client/client.c b/source3/client/client.c index 7561ecb6a3..f18505a418 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -3853,7 +3853,7 @@ static int do_message_op(void) snprintf(name_type_hex, sizeof(name_type_hex), "#%X", name_type); fstrcat(server_name, name_type_hex); - zero_addr(&ss,AF_INET); + zero_addr(&ss); if (have_ip) ss = dest_ss; diff --git a/source3/client/smbmount.c b/source3/client/smbmount.c index 0c57c405cf..9c671e3ef7 100644 --- a/source3/client/smbmount.c +++ b/source3/client/smbmount.c @@ -146,7 +146,7 @@ static struct cli_state *do_connection(char *the_service) make_nmb_name(&called , server, 0x20); again: - zero_addr(&ip, AF_INET); + zero_addr(&ip); if (have_ip) ip = dest_ip; /* have to open a new connection */ diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index 91da407458..e66bd5f15a 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -238,7 +238,7 @@ bool interpret_string_addr(struct sockaddr_storage *pss, } #endif - zero_addr(pss, AF_INET); + zero_addr(pss); if (!interpret_string_addr_internal(&res, str, flags|AI_ADDRCONFIG)) { return false; @@ -343,14 +343,14 @@ void zero_ip_v4(struct in_addr *ip) } /******************************************************************* - Set an address to INADDR_ANY, or IN6ADDR_ANY. + Set an address to INADDR_ANY. ******************************************************************/ -void zero_addr(struct sockaddr_storage *pss, int family) +void zero_addr(struct sockaddr_storage *pss) { memset(pss, '\0', sizeof(*pss)); /* Ensure we're at least a valid sockaddr-storage. */ - pss->ss_family = family; + pss->ss_family = AF_INET; } /******************************************************************* diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index 826315ad7a..448bfd7663 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -1519,7 +1519,7 @@ NTSTATUS cli_start_connection(struct cli_state **output_cli, if (dest_ss) { ss = *dest_ss; } else { - zero_addr(&ss, AF_INET); + zero_addr(&ss); } again: diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c index e1ca924b09..6393f654c0 100644 --- a/source3/libsmb/clidfs.c +++ b/source3/libsmb/clidfs.c @@ -83,13 +83,13 @@ static struct cli_state *do_connect( const char *server, const char *share, server_n = server; - zero_addr(&ss, AF_INET); + zero_addr(&ss); make_nmb_name(&calling, global_myname(), 0x0); make_nmb_name(&called , server, name_type); again: - zero_addr(&ss, AF_INET); + zero_addr(&ss); if (have_ip) ss = dest_ss; diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c index d5bf1828c6..0b45cad3e1 100644 --- a/source3/libsmb/libsmbclient.c +++ b/source3/libsmb/libsmbclient.c @@ -654,7 +654,7 @@ smbc_server(SMBCCTX *context, const char *username_used; NTSTATUS status; - zero_addr(&ss, AF_INET); + zero_addr(&ss); ZERO_STRUCT(c); if (server[0] == 0) { @@ -742,7 +742,7 @@ smbc_server(SMBCCTX *context, again: slprintf(ipenv,sizeof(ipenv)-1,"HOST_%s", server_n); - zero_addr(&ss, AF_INET); + zero_addr(&ss); /* have to open a new connection */ if ((c = cli_initialise()) == NULL) { @@ -964,7 +964,7 @@ smbc_attr_server(SMBCCTX *context, flags |= CLI_FULL_CONNECTION_USE_KERBEROS; } - zero_addr(&ss, AF_INET); + zero_addr(&ss); nt_status = cli_full_connection(&ipc_cli, global_myname(), server, &ss, 0, "IPC$", "?????", diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index 34fe09b8c2..f4c516921c 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -331,7 +331,7 @@ bool name_status_find(const char *q_name, if (!interpret_string_addr(&ss, lp_socket_address(), AI_NUMERICHOST|AI_PASSIVE)) { - zero_addr(&ss, AF_INET); + zero_addr(&ss); } sock = open_socket_in(SOCK_DGRAM, 0, 3, &ss, True); @@ -528,7 +528,7 @@ static int remove_duplicate_addrs2(struct ip_service *iplist, int count ) for ( j=i+1; jldap.ss; #else - zero_addr(dc_ss,AF_INET); + zero_addr(dc_ss); #endif ads_destroy(&ads); @@ -217,7 +217,7 @@ bool get_dc_name(const char *domain, bool ret; bool our_domain = False; - zero_addr(&dc_ss, AF_INET); + zero_addr(&dc_ss); ret = False; diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index 2c285704de..6d318ae7ec 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -745,7 +745,7 @@ out_free: load_case_tables(); - zero_addr(&server_ss, AF_INET); + zero_addr(&server_ss); setlinebuf(stdout); diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index f69f8bf48f..baf676f646 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -174,7 +174,7 @@ static struct cli_state *connect_one(char *share, int snum) server_n = server; - zero_addr(&ss, AF_INET); + zero_addr(&ss); slprintf(myname,sizeof(myname), "lock-%lu-%u", (unsigned long)getpid(), count++); @@ -182,7 +182,7 @@ static struct cli_state *connect_one(char *share, int snum) make_nmb_name(&called , server, 0x20); again: - zero_addr(&ss, AF_INET); + zero_addr(&ss); /* have to open a new connection */ if (!(c=cli_initialise())) { diff --git a/source3/torture/masktest.c b/source3/torture/masktest.c index 354607bb4e..62b24dc1d9 100644 --- a/source3/torture/masktest.c +++ b/source3/torture/masktest.c @@ -179,13 +179,13 @@ static struct cli_state *connect_one(char *share) server_n = server; - zero_addr(&ss, AF_INET); + zero_addr(&ss); make_nmb_name(&calling, "masktest", 0x0); make_nmb_name(&called , server, 0x20); again: - zero_addr(&ss, AF_INET); + zero_addr(&ss); /* have to open a new connection */ if (!(c=cli_initialise())) { diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 8eb29d837d..697d87adc7 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -106,7 +106,7 @@ static struct cli_state *open_nbt_connection(void) make_nmb_name(&calling, myname, 0x0); make_nmb_name(&called , host, 0x20); - zero_addr(&ss, AF_INET); + zero_addr(&ss); if (!(c = cli_initialise())) { printf("Failed initialize cli_struct to connect with %s\n", host); diff --git a/source3/utils/net.c b/source3/utils/net.c index fb82e76591..2390e5842c 100644 --- a/source3/utils/net.c +++ b/source3/utils/net.c @@ -1012,7 +1012,7 @@ static struct functable net_func[] = { TALLOC_CTX *frame = talloc_stackframe(); - zero_addr(&opt_dest_ip, AF_INET); + zero_addr(&opt_dest_ip); load_case_tables(); diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c index d5bf9b96e6..9af2294f54 100644 --- a/source3/utils/smbcacls.c +++ b/source3/utils/smbcacls.c @@ -769,7 +769,7 @@ static struct cli_state *connect_one(const char *share) struct cli_state *c; struct sockaddr_storage ss; NTSTATUS nt_status; - zero_addr(&ss, AF_INET); + zero_addr(&ss); if (!cmdline_auth_info.got_pass) { char *pass = getpass("Password: "); diff --git a/source3/utils/smbcquotas.c b/source3/utils/smbcquotas.c index f185caa50f..ae793c28f9 100644 --- a/source3/utils/smbcquotas.c +++ b/source3/utils/smbcquotas.c @@ -361,7 +361,7 @@ static struct cli_state *connect_one(const char *share) struct cli_state *c; struct sockaddr_storage ss; NTSTATUS nt_status; - zero_addr(&ss, AF_INET); + zero_addr(&ss); if (!cmdline_auth_info.got_pass) { char *pass = getpass("Password: "); -- cgit