diff options
author | Tim Potter <tpot@samba.org> | 2001-11-26 03:11:44 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2001-11-26 03:11:44 +0000 |
commit | 585d0efbc6428e5876d354fee49c241c1bad809d (patch) | |
tree | 48ef6538dc6855f6084a63fde1097032cc9e2ebc /source3 | |
parent | 8b7434b2a0b8d138cd83e4feeecb9127d729c437 (diff) | |
download | samba-585d0efbc6428e5876d354fee49c241c1bad809d.tar.gz samba-585d0efbc6428e5876d354fee49c241c1bad809d.tar.xz samba-585d0efbc6428e5876d354fee49c241c1bad809d.zip |
Got medieval on another pointless extern. Removed extern struct ipzero
and replaced with two functions:
void zero_ip(struct in_adder *ip);
BOOL is_zero_ip(struct in_addr ip);
(This used to be commit 778f5f77a66cda76348a7c6f64cd63afe2bfe077)
Diffstat (limited to 'source3')
30 files changed, 70 insertions, 86 deletions
diff --git a/source3/auth/auth_domain.c b/source3/auth/auth_domain.c index fa6093a592..f3c2fa97e4 100644 --- a/source3/auth/auth_domain.c +++ b/source3/auth/auth_domain.c @@ -24,8 +24,6 @@ BOOL global_machine_password_needs_changing = False; -extern struct in_addr ipzero; - extern pstring global_myname; /*********************************************************************** @@ -183,7 +181,7 @@ static BOOL attempt_connect_to_dc(struct cli_state *pcli, struct in_addr *ip, * Ignore addresses we have already tried. */ - if (ip_equal(ipzero, *ip)) + if (is_zero_ip(*ip)) return False; if (!lookup_pdc_name(global_myname, lp_workgroup(), ip, dc_name)) @@ -232,7 +230,7 @@ static BOOL find_connect_pdc(struct cli_state *pcli, if((connected_ok = attempt_connect_to_dc(pcli, &ip_list[i], trust_passwd))) break; - ip_list[i] = ipzero; /* Tried and failed. */ + zero_ip(&ip_list[i]); /* Tried and failed. */ } /* @@ -242,7 +240,7 @@ static BOOL find_connect_pdc(struct cli_state *pcli, i = (sys_random() % count); if (!(connected_ok = attempt_connect_to_dc(pcli, &ip_list[i], trust_passwd))) - ip_list[i] = ipzero; /* Tried and failed. */ + zero_ip(&ip_list[i]); /* Tried and failed. */ } /* diff --git a/source3/client/client.c b/source3/client/client.c index c684f3fea6..2b0867cf7b 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -45,7 +45,6 @@ static char *cmdstr; static BOOL got_pass; static int io_bufsize = 64512; static BOOL use_kerberos; -extern struct in_addr ipzero; static int name_type = 0x20; static int max_protocol = PROTOCOL_NT1; @@ -2085,7 +2084,6 @@ struct cli_state *do_connect(const char *server, const char *share) struct nmb_name called, calling; const char *server_n; struct in_addr ip; - extern struct in_addr ipzero; fstring servicename; char *sharename; @@ -2102,13 +2100,13 @@ struct cli_state *do_connect(const char *server, const char *share) server_n = server; - ip = ipzero; + zero_ip(&ip); make_nmb_name(&calling, global_myname, 0x0); make_nmb_name(&called , server, name_type); again: - ip = ipzero; + zero_ip(&ip); if (have_ip) ip = dest_ip; /* have to open a new connection */ @@ -2366,12 +2364,12 @@ static int do_message_op(void) struct in_addr ip; struct nmb_name called, calling; - ip = ipzero; + zero_ip(&ip); make_nmb_name(&calling, global_myname, 0x0); make_nmb_name(&called , desthost, name_type); - ip = ipzero; + zero_ip(&ip); if (have_ip) ip = dest_ip; if (!(cli=cli_initialise(NULL)) || (cli_set_port(cli, port) != port) || !cli_connect(cli, desthost, &ip)) { @@ -2584,7 +2582,7 @@ static int do_message_op(void) case 'I': { dest_ip = *interpret_addr2(optarg); - if (zero_ip(dest_ip)) + if (is_zero_ip(dest_ip)) exit(1); have_ip = True; } diff --git a/source3/client/smbmount.c b/source3/client/smbmount.c index d929599e56..3aeddfabca 100644 --- a/source3/client/smbmount.c +++ b/source3/client/smbmount.c @@ -27,8 +27,6 @@ #include <asm/types.h> #include <linux/smb_fs.h> -extern struct in_addr ipzero; - extern BOOL in_client; extern pstring user_socket_options; extern BOOL append_log; @@ -119,7 +117,6 @@ static struct cli_state *do_connection(char *the_service) struct nmb_name called, calling; char *server_n; struct in_addr ip; - extern struct in_addr ipzero; pstring server; char *share; @@ -143,7 +140,7 @@ static struct cli_state *do_connection(char *the_service) make_nmb_name(&called , server, 0x20); again: - ip = ipzero; + zero_ip(&ip); if (have_ip) ip = dest_ip; /* have to open a new connection */ @@ -756,7 +753,7 @@ static void parse_mount_smb(int argc, char **argv) DEBUGLEVEL = val; } else if(!strcmp(opts, "ip")) { dest_ip = *interpret_addr2(opteq+1); - if (zero_ip(dest_ip)) { + if (is_zero_ip(dest_ip)) { fprintf(stderr,"Can't resolve address %s\n", opteq+1); exit(1); } diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c index 3d049b588e..3e583e855e 100644 --- a/source3/client/smbspool.c +++ b/source3/client/smbspool.c @@ -29,7 +29,6 @@ */ extern BOOL in_client; /* Boolean for client library */ -extern struct in_addr ipzero; /* Any address */ /* @@ -285,7 +284,7 @@ smb_connect(char *workgroup, /* I - Workgroup */ get_myname(myname); - ip = ipzero; + zero_ip(&ip); make_nmb_name(&calling, myname, 0x0); make_nmb_name(&called, server, 0x20); diff --git a/source3/lib/interface.c b/source3/lib/interface.c index d2e0b44fd4..a93390e643 100644 --- a/source3/lib/interface.c +++ b/source3/lib/interface.c @@ -26,7 +26,6 @@ static struct iface_struct *probed_ifaces; static int total_probed; -struct in_addr ipzero; struct in_addr allones_ip; struct in_addr loopback_ip; @@ -42,7 +41,7 @@ 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 (zero_ip(ip)) return local_interfaces; + if (is_zero_ip(ip)) return local_interfaces; for (i=local_interfaces;i;i=i->next) if (CheckMask) { @@ -104,8 +103,8 @@ static void interpret_interface(char *token) char *p; int i, added=0; - ip = ipzero; - nmask = ipzero; + zero_ip(&ip); + zero_ip(&nmask); /* first check if it is an interface name */ for (i=0;i<total_probed;i++) { @@ -172,7 +171,6 @@ void load_interfaces(void) ptr = lp_interfaces(); - ipzero = *interpret_addr2("0.0.0.0"); allones_ip = *interpret_addr2("255.255.255.255"); loopback_ip = *interpret_addr2("127.0.0.1"); diff --git a/source3/lib/util.c b/source3/lib/util.c index dc948a406b..01fb51d5a2 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -841,13 +841,27 @@ struct in_addr *interpret_addr2(const char *str) /******************************************************************* check if an IP is the 0.0.0.0 ******************************************************************/ -BOOL zero_ip(struct in_addr ip) +BOOL is_zero_ip(struct in_addr ip) { uint32 a; putip((char *)&a,(char *)&ip); return(a == 0); } +/* Set an IP to 0.0.0.0 */ + +void zero_ip(struct in_addr *ip) +{ + static BOOL init; + static struct in_addr ipzero; + + if (!init) { + ipzero = *interpret_addr2("0.0.0.0"); + init = True; + } + + *ip = ipzero; +} #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT)) /****************************************************************** diff --git a/source3/lib/wins_srv.c b/source3/lib/wins_srv.c index 5a9b065008..92cd51d8bb 100644 --- a/source3/lib/wins_srv.c +++ b/source3/lib/wins_srv.c @@ -209,11 +209,11 @@ struct in_addr wins_srv_ip( void ) if( now >= entry->mourning ) /* Found a live one. */ { /* If we don't have the IP, look it up. */ - if( zero_ip( entry->ip_addr ) ) + if( is_zero_ip( entry->ip_addr ) ) entry->ip_addr = *interpret_addr2( entry->server ); /* If we still don't have the IP then kill it, else return it. */ - if( zero_ip( entry->ip_addr ) ) + if( is_zero_ip( entry->ip_addr ) ) entry->mourning = now + NECROMANCYCLE; else return( entry->ip_addr ); @@ -278,7 +278,7 @@ void wins_srv_died( struct in_addr boothill_ip ) { list_entry *entry; - if( zero_ip( boothill_ip ) ) + if( is_zero_ip( boothill_ip ) ) { DEBUG( 4, ("wins_srv_died(): Invalid request to mark zero IP down.\n") ); return; diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index ffbc54ea5e..314ac6638a 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -972,12 +972,11 @@ open the client sockets ****************************************************************************/ BOOL cli_connect(struct cli_state *cli, const char *host, struct in_addr *ip) { - extern struct in_addr ipzero; extern pstring user_socket_options; fstrcpy(cli->desthost, host); - if (!ip || ip_equal(*ip, ipzero)) { + if (!ip || is_zero_ip(*ip)) { if (!resolve_name( cli->desthost, &cli->dest_ip, 0x20)) { return False; } diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c index ce00548518..a85d9e45fc 100644 --- a/source3/libsmb/libsmbclient.c +++ b/source3/libsmb/libsmbclient.c @@ -246,9 +246,8 @@ struct smbc_server *smbc_server(char *server, char *share, fstring group; pstring ipenv; struct in_addr ip; - extern struct in_addr ipzero; - ip = ipzero; + zero_ip(&ip); ZERO_STRUCT(c); /* try to use an existing connection */ @@ -306,7 +305,7 @@ struct smbc_server *smbc_server(char *server, char *share, again: slprintf(ipenv,sizeof(ipenv)-1,"HOST_%s", server_n); - ip = ipzero; + zero_ip(&ip); /* have to open a new connection */ if (!cli_initialise(&c) || !cli_connect(&c, server_n, &ip)) { diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index 314eead565..1b6547f6c3 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -48,8 +48,6 @@ BOOL found_lm_clients = False; time_t StartupTime = 0; -extern struct in_addr ipzero; - /**************************************************************************** ** catch a sigterm **************************************************************************** */ diff --git a/source3/nmbd/nmbd_become_dmb.c b/source3/nmbd/nmbd_become_dmb.c index 8a9fbaedd5..d62607a643 100644 --- a/source3/nmbd/nmbd_become_dmb.c +++ b/source3/nmbd/nmbd_become_dmb.c @@ -27,7 +27,6 @@ extern pstring global_myname; extern fstring global_myworkgroup; extern char **my_netbios_names; -extern struct in_addr ipzero; extern struct in_addr allones_ip; extern uint16 samba_nb_type; /* Samba's NetBIOS type. */ @@ -214,7 +213,7 @@ static void become_domain_master_query_success(struct subnet_record *subrec, /* BUG note. Samba 1.9.16p11 servers seem to return the broadcast address or zero ip for this query. Pretend this is ok. */ - if(ismyip(ip) || ip_equal(allones_ip, ip) || ip_equal(ipzero, ip)) + if(ismyip(ip) || ip_equal(allones_ip, ip) || is_zero_ip(ip)) { if( DEBUGLVL( 3 ) ) { diff --git a/source3/nmbd/nmbd_browsesync.c b/source3/nmbd/nmbd_browsesync.c index 6a8edd0eaf..35bd29334e 100644 --- a/source3/nmbd/nmbd_browsesync.c +++ b/source3/nmbd/nmbd_browsesync.c @@ -25,7 +25,6 @@ #include "includes.h" #include "smb.h" -extern struct in_addr ipzero; extern pstring global_myname; extern fstring global_myworkgroup; @@ -308,7 +307,7 @@ static void find_domain_master_name_query_success(struct subnet_record *subrec, /* First check if we already have a dmb for this workgroup. */ - if(!ip_equal(work->dmb_addr, ipzero) && ip_equal(work->dmb_addr, answer_ip)) + if(!is_zero_ip(work->dmb_addr) && ip_equal(work->dmb_addr, answer_ip)) { /* Do the local master browser announcement to the domain master browser name and IP. */ @@ -319,7 +318,7 @@ static void find_domain_master_name_query_success(struct subnet_record *subrec, return; } else - putip((char *)&work->dmb_addr, &ipzero); + zero_ip(&work->dmb_addr); /* Now initiate the node status request. */ make_nmb_name(&nmbname,"*",0x0); diff --git a/source3/nmbd/nmbd_logonnames.c b/source3/nmbd/nmbd_logonnames.c index 4f48b21b7f..52340f1f31 100644 --- a/source3/nmbd/nmbd_logonnames.c +++ b/source3/nmbd/nmbd_logonnames.c @@ -27,7 +27,6 @@ extern pstring global_myname; extern fstring global_myworkgroup; extern char **my_netbios_names; -extern struct in_addr ipzero; extern struct in_addr allones_ip; extern uint16 samba_nb_type; /* Samba's NetBIOS type. */ diff --git a/source3/nmbd/nmbd_namequery.c b/source3/nmbd/nmbd_namequery.c index 1f0895ee37..9d2a7a4895 100644 --- a/source3/nmbd/nmbd_namequery.c +++ b/source3/nmbd/nmbd_namequery.c @@ -24,8 +24,6 @@ #include "includes.h" -extern struct in_addr ipzero; - /**************************************************************************** Deal with a response packet when querying a name. ****************************************************************************/ @@ -38,7 +36,9 @@ static void query_name_response( struct subnet_record *subrec, BOOL success = False; struct nmb_name *question_name = &rrec->packet->packet.nmb.question.question_name; - struct in_addr answer_ip = ipzero; + struct in_addr answer_ip; + + zero_ip(&answer_ip); /* Ensure we don't retry the query but leave the response record cleanup to the timeout code. We may get more answer responses in which case diff --git a/source3/nmbd/nmbd_responserecordsdb.c b/source3/nmbd/nmbd_responserecordsdb.c index b24c85a9d8..63601ff26c 100644 --- a/source3/nmbd/nmbd_responserecordsdb.c +++ b/source3/nmbd/nmbd_responserecordsdb.c @@ -26,8 +26,6 @@ extern int ClientNMB; -extern struct in_addr ipzero; - int num_response_packets = 0; /*************************************************************************** diff --git a/source3/nmbd/nmbd_subnetdb.c b/source3/nmbd/nmbd_subnetdb.c index ebb6bfa9c6..3b450f6712 100644 --- a/source3/nmbd/nmbd_subnetdb.c +++ b/source3/nmbd/nmbd_subnetdb.c @@ -33,7 +33,6 @@ extern int global_nmb_port; extern fstring myworkgroup; extern char **my_netbios_names; -extern struct in_addr ipzero; /* This is the broadcast subnets database. */ struct subnet_record *subnetlist = NULL; @@ -232,7 +231,7 @@ BOOL create_subnets(void) { int num_interfaces = iface_count(); int i; - struct in_addr unicast_ip; + struct in_addr unicast_ip, ipzero; extern struct in_addr loopback_ip; if(num_interfaces == 0) @@ -280,7 +279,7 @@ BOOL create_subnets(void) struct in_addr real_wins_ip; real_wins_ip = wins_srv_ip(); - if (!zero_ip(real_wins_ip)) + if (!is_zero_ip(real_wins_ip)) { unicast_ip = real_wins_ip; } @@ -302,7 +301,7 @@ BOOL create_subnets(void) { /* We should not be using a WINS server at all. Set the ip address of the subnet to be zero. */ - unicast_ip = ipzero; + zero_ip(&unicast_ip); } /* @@ -315,6 +314,8 @@ BOOL create_subnets(void) unicast_subnet = make_subnet( "UNICAST_SUBNET", UNICAST_SUBNET, unicast_ip, unicast_ip, unicast_ip); + zero_ip(&ipzero); + remote_broadcast_subnet = make_subnet( "REMOTE_BROADCAST_SUBNET", REMOTE_BROADCAST_SUBNET, ipzero, ipzero, ipzero); @@ -347,7 +348,7 @@ BOOL we_are_a_wins_client(void) static int cache_we_are_a_wins_client = -1; if(cache_we_are_a_wins_client == -1) - cache_we_are_a_wins_client = (ip_equal(ipzero, unicast_subnet->myip) ? + cache_we_are_a_wins_client = (is_zero_ip(unicast_subnet->myip) ? False : True); return cache_we_are_a_wins_client; diff --git a/source3/nmbd/nmbd_winsserver.c b/source3/nmbd/nmbd_winsserver.c index ea025e66f3..ecb5f2da55 100644 --- a/source3/nmbd/nmbd_winsserver.c +++ b/source3/nmbd/nmbd_winsserver.c @@ -26,8 +26,6 @@ #define WINS_LIST "wins.dat" #define WINS_VERSION 1 -extern struct in_addr ipzero; - /**************************************************************************** possibly call the WINS hook external program when a WINS change is made *****************************************************************************/ diff --git a/source3/nmbd/nmbd_workgroupdb.c b/source3/nmbd/nmbd_workgroupdb.c index 3b7a64b8e5..4551eaf46b 100644 --- a/source3/nmbd/nmbd_workgroupdb.c +++ b/source3/nmbd/nmbd_workgroupdb.c @@ -31,7 +31,6 @@ extern pstring global_myname; extern fstring global_myworkgroup; extern char **my_netbios_names; extern uint16 samba_nb_type; -extern struct in_addr ipzero; int workgroup_count = 0; /* unique index key: one for each workgroup */ @@ -101,7 +100,7 @@ static struct work_record *create_workgroup(const char *name, int ttl) /* No known domain master browser as yet. */ *work->dmb_name.name = '\0'; - putip((char *)&work->dmb_addr, &ipzero); + zero_ip(&work->dmb_addr); /* WfWg uses 01040b01 */ /* Win95 uses 01041501 */ diff --git a/source3/nsswitch/wins.c b/source3/nsswitch/wins.c index e23cf9ea03..abc7b6f414 100644 --- a/source3/nsswitch/wins.c +++ b/source3/nsswitch/wins.c @@ -88,13 +88,13 @@ struct in_addr *lookup_backend(const char *name, int *count) /* The next four lines commented out by JHT and replaced with the four lines following */ -/* if( !zero_ip( wins_ip ) ) { +/* if( !is_zero_ip( wins_ip ) ) { * ret = name_query( fd, name, 0x20, False, True, wins_src_ip(), count ); * goto out; * } */ p = wins_srv_ip(); - if( !zero_ip(p) ) { + if( !is_zero_ip(p) ) { ret = name_query(fd,name,0x20,False,True, p, count); goto out; } diff --git a/source3/smbd/password.c b/source3/smbd/password.c index 510e18919d..71837efdcb 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -21,8 +21,6 @@ #include "includes.h" -extern struct in_addr ipzero; - /* users from session setup */ static pstring session_users=""; diff --git a/source3/smbwrapper/smbw.c b/source3/smbwrapper/smbw.c index b4b0b28f36..047db9bb96 100644 --- a/source3/smbwrapper/smbw.c +++ b/source3/smbwrapper/smbw.c @@ -442,9 +442,8 @@ struct smbw_server *smbw_server(char *server, char *share) fstring group; pstring ipenv; struct in_addr ip; - extern struct in_addr ipzero; - ip = ipzero; + zero_ip(&ip); ZERO_STRUCT(c); get_auth_data_fn(server, share, &workgroup, &username, &password); @@ -495,7 +494,7 @@ struct smbw_server *smbw_server(char *server, char *share) again: slprintf(ipenv,sizeof(ipenv)-1,"HOST_%s", server_n); - ip = ipzero; + zero_ip(&ip); if ((p=smbw_getshared(ipenv))) { ip = *(interpret_addr2(p)); } diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index ccff2b2624..8606c9e38a 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -147,7 +147,6 @@ struct cli_state *connect_one(char *share) char *server_n; fstring server; struct in_addr ip; - extern struct in_addr ipzero; fstring myname; static int count; @@ -159,7 +158,7 @@ struct cli_state *connect_one(char *share) server_n = server; - ip = ipzero; + zero_ip(&ip); slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), count++); @@ -167,7 +166,7 @@ struct cli_state *connect_one(char *share) make_nmb_name(&called , server, 0x20); again: - ip = ipzero; + zero_ip(&ip); /* have to open a new connection */ if (!(c=cli_initialise(NULL)) || !cli_connect(c, server_n, &ip)) { diff --git a/source3/torture/locktest2.c b/source3/torture/locktest2.c index db5e17921c..49c8b2a8a9 100644 --- a/source3/torture/locktest2.c +++ b/source3/torture/locktest2.c @@ -157,7 +157,6 @@ struct cli_state *connect_one(char *share) char *server_n; fstring server; struct in_addr ip; - extern struct in_addr ipzero; fstring myname; static int count; @@ -169,7 +168,7 @@ struct cli_state *connect_one(char *share) server_n = server; - ip = ipzero; + zero_ip(&ip); slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), count++); @@ -177,7 +176,7 @@ struct cli_state *connect_one(char *share) make_nmb_name(&called , server, 0x20); again: - ip = ipzero; + zero_ip(&ip); /* have to open a new connection */ if (!(c=cli_initialise(NULL)) || !cli_connect(c, server_n, &ip)) { diff --git a/source3/torture/masktest.c b/source3/torture/masktest.c index d57b26bee4..e8c88a9fc1 100644 --- a/source3/torture/masktest.c +++ b/source3/torture/masktest.c @@ -165,7 +165,6 @@ struct cli_state *connect_one(char *share) char *server_n; char *server; struct in_addr ip; - extern struct in_addr ipzero; server = share+2; share = strchr_m(server,'\\'); @@ -175,13 +174,13 @@ struct cli_state *connect_one(char *share) server_n = server; - ip = ipzero; + zero_ip(&ip); make_nmb_name(&calling, "masktest", 0x0); make_nmb_name(&called , server, 0x20); again: - ip = ipzero; + zero_ip(&ip); /* have to open a new connection */ if (!(c=cli_initialise(NULL)) || !cli_connect(c, server_n, &ip)) { diff --git a/source3/torture/rpctorture.c b/source3/torture/rpctorture.c index e767c715e9..231e3a75f5 100644 --- a/source3/torture/rpctorture.c +++ b/source3/torture/rpctorture.c @@ -409,7 +409,7 @@ enum client_action case 'I': { cli_info.dest_ip = *interpret_addr2(optarg); - if (zero_ip(cli_info.dest_ip)) + if (is_zero_ip(cli_info.dest_ip)) { exit(1); } diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 234f3d3335..bc3310886d 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -93,14 +93,13 @@ static BOOL open_nbt_connection(struct cli_state *c) { struct nmb_name called, calling; struct in_addr ip; - extern struct in_addr ipzero; ZERO_STRUCTP(c); make_nmb_name(&calling, myname, 0x0); make_nmb_name(&called , host, 0x20); - ip = ipzero; + zero_ip(&ip); if (!cli_initialise(c) || !cli_connect(c, host, &ip)) { printf("Failed to connect with %s\n", host); diff --git a/source3/utils/net.c b/source3/utils/net.c index 224de31ebf..d0d73b59f3 100644 --- a/source3/utils/net.c +++ b/source3/utils/net.c @@ -286,7 +286,6 @@ static const char *share_type[] = { /************************************************************************************/ extern int optind, opterr, optopt; -extern struct in_addr ipzero; static struct cli_state *cli; static char *opt_requester_name; @@ -355,14 +354,15 @@ static struct cli_state *connect_to_ipc(char *server) server_n = server; - ip = ipzero; + zero_ip(&ip); make_nmb_name(&calling, opt_requester_name, 0x0); make_nmb_name(&called , server, 0x20); again: if (have_ip) ip = dest_ip; - else ip = ipzero; + else + zero_ip(&ip); DEBUG(3,("Connecting to host=%s\\share=%s\n\n", server, "IPC$")); @@ -1276,7 +1276,7 @@ int main(int argc,char *argv[]) }; got_pass = 0; - dest_ip = ipzero; + zero_ip(&dest_ip); dbf = x_stdout; @@ -1291,7 +1291,7 @@ int main(int argc,char *argv[]) break; case 'I': dest_ip = *interpret_addr2(poptGetOptArg(pc)); - if (zero_ip(dest_ip)) + if (is_zero_ip(dest_ip)) d_printf(ERRMSG_INVALID_IPADDRESS); else have_ip = True; diff --git a/source3/utils/nmblookup.c b/source3/utils/nmblookup.c index cad9bf85c3..5b22872cb3 100644 --- a/source3/utils/nmblookup.c +++ b/source3/utils/nmblookup.c @@ -24,8 +24,6 @@ #include "includes.h" -extern struct in_addr ipzero; - static BOOL use_bcast = True; static BOOL got_bcast = False; static struct in_addr bcast_addr; diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c index ae03e193e1..2605442e8a 100644 --- a/source3/utils/smbcacls.c +++ b/source3/utils/smbcacls.c @@ -690,7 +690,6 @@ struct cli_state *connect_one(char *share) struct cli_state *c; struct nmb_name called, calling; struct in_addr ip; - extern struct in_addr ipzero; extern pstring global_myname; fstrcpy(server,share+2); @@ -699,13 +698,13 @@ struct cli_state *connect_one(char *share) *share = 0; share++; - ip = ipzero; + zero_ip(&ip); make_nmb_name(&calling, global_myname, 0x0); make_nmb_name(&called , server, 0x20); again: - ip = ipzero; + zero_ip(&ip); /* have to open a new connection */ if (!(c=cli_initialise(NULL)) || !cli_connect(c, server, &ip)) { diff --git a/source3/utils/smbtree.c b/source3/utils/smbtree.c index 13df0451f0..5b7e8a73c1 100644 --- a/source3/utils/smbtree.c +++ b/source3/utils/smbtree.c @@ -94,11 +94,12 @@ static struct cli_state *get_ipc_connect(char *server, struct user_auth_info *user_info) { struct nmb_name calling, called; - extern struct in_addr ipzero; - struct in_addr server_ip = ipzero; + struct in_addr server_ip; struct cli_state *cli; pstring myname; + zero_ip(&server_ip); + get_myname(myname); make_nmb_name(&called, myname, 0x0); |