diff options
Diffstat (limited to 'source3/client')
-rw-r--r-- | source3/client/client.c | 12 | ||||
-rw-r--r-- | source3/client/clientutil.c | 34 |
2 files changed, 13 insertions, 33 deletions
diff --git a/source3/client/client.c b/source3/client/client.c index da44f344dd..679114fa2b 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -3500,6 +3500,7 @@ static void usage(char *pname) DEBUG(0,("\t-m max protocol set the max protocol level\n")); DEBUG(0,("\t-L host get a list of shares available on a host\n")); DEBUG(0,("\t-I dest IP use this IP to connect to\n")); + DEBUG(0,("\t-R name resolve order use these name resolution services only\n")); DEBUG(0,("\t-E write messages to stderr instead of stdout\n")); DEBUG(0,("\t-U username set the network username\n")); DEBUG(0,("\t-W workgroup set the workgroup name\n")); @@ -3528,6 +3529,7 @@ static void usage(char *pname) extern char tar_type; static pstring servicesf = CONFIGFILE; pstring term_code; + pstring new_name_resolve_order; char *p; #ifdef KANJI @@ -3539,6 +3541,8 @@ static void usage(char *pname) *query_host = 0; *base_directory = 0; + *new_name_resolve_order = 0; + DEBUGLEVEL = 2; setup_logging(pname,True); @@ -3624,7 +3628,7 @@ static void usage(char *pname) } while ((opt = - getopt(argc, argv,"s:B:O:M:S:i:Nn:d:Pp:l:hI:EB:U:L:t:m:W:T:D:c:")) != EOF) + getopt(argc, argv,"s:B:O:R:M:S:i:Nn:d:Pp:l:hI:EB:U:L:t:m:W:T:D:c:")) != EOF) switch (opt) { case 'm': @@ -3633,6 +3637,9 @@ static void usage(char *pname) case 'O': strcpy(user_socket_options,optarg); break; + case 'R': + pstrcpy(new_name_resolve_order, optarg); + break; case 'S': strcpy(desthost,optarg); strupper(desthost); @@ -3760,6 +3767,9 @@ static void usage(char *pname) get_myname((*myname)?NULL:myname,NULL); strupper(myname); + if(*new_name_resolve_order) + lp_set_name_resolve_order(new_name_resolve_order); + if (tar_type) { recurse=True; diff --git a/source3/client/clientutil.c b/source3/client/clientutil.c index 8d5e11e4d8..2afac354c2 100644 --- a/source3/client/clientutil.c +++ b/source3/client/clientutil.c @@ -29,8 +29,6 @@ #define REGISTER 0 #endif -#define USENMB - pstring service=""; pstring desthost=""; extern pstring myname; @@ -863,7 +861,6 @@ BOOL cli_open_sockets(int port ) char *host; pstring service2; extern int Client; - BOOL failed = True; if (port == 0) port=last_port; last_port=port; @@ -894,37 +891,10 @@ BOOL cli_open_sockets(int port ) if (!have_ip) { - struct hostent *hp; - - if ((hp = Get_Hostbyname(host))) - { - putip((char *)&dest_ip,(char *)hp->h_addr); - failed = False; - } - else + if(!resolve_name( host, &dest_ip)) { -#ifdef USENMB - /* Try and resolve the name with the netbios server */ - int bcast, count; - struct in_addr *ip_list; - - if ((bcast = open_socket_in(SOCK_DGRAM, 0, 3, - interpret_addr(lp_socket_address()))) != -1) { - set_socket_options(bcast, "SO_BROADCAST"); - - if ((ip_list = name_query(bcast, host, name_type, True, True, *iface_bcast(dest_ip), - &count,0)) != NULL) { - dest_ip = ip_list[0]; - free(ip_list); - failed = False; - } - close (bcast); - } -#endif - if (failed) { - DEBUG(0,("Get_Hostbyname: Unknown host %s.\n",host)); + DEBUG(0,("cli_open_sockets: Unknown host %s.\n",host)); return False; - } } } |