Patch against samba 3.0.0 client/client.c Mainly for -L parameter options 1.) Add a configurable connection delay. The default is too long. Add items to long_options of poptOption for help message, however I just put something "i.e. CONNSETUP" to the last parameter of long_options. It seems for use of documentation ???? 2.) Remark the code that require list_servers must using port 139. It seems that 445 can also used.. Also a user may be forced to make a connection to port 139, however he may wants to use port 445 only. 3.) Add OS, Domain and server name display for -L option. (Just copy from do_connect debug message). It is better to let user always know is the os of the remote machine. Keith Mok ======================================== --- client.c.orig 2003-10-27 01:38:55.000000000 +0800 +++ client.c 2003-10-27 01:38:37.000000000 +0800 @@ -49,6 +49,8 @@ static int process_tok(fstring tok); static int cmd_help(void); +static int connect_timeout = 20*1000; + /* 30 second timeout on most commands */ #define CLIENT_TIMEOUT (30*1000) #define SHORT_TIMEOUT (5*1000) @@ -2533,7 +2535,9 @@ if (have_ip) ip = dest_ip; /* have to open a new connection */ - if (!(c=cli_initialise(NULL)) || (cli_set_port(c, port) != port) || + + if (!(c=cli_initialise(NULL)) || !(c->timeout = connect_timeout) || + (cli_set_port(c, port) != port) || !cli_connect(c, server_n, &ip)) { d_printf("Connection to %s failed\n", server_n); return NULL; @@ -2650,22 +2654,33 @@ if (!cli) return 1; + if (*cli->server_domain) { + printf("Domain=[%s] OS=[%s] Server=[%s]\n", + cli->server_domain,cli->server_os,cli->server_type); + } else if (*cli->server_os || *cli->server_type){ + printf("OS=[%s] Server=[%s]\n", + cli->server_os,cli->server_type); + } + browse_host(True); + /* if (port != 139) { - - /* Workgroups simply don't make sense over anything - else but port 139... */ + + ==== Seems not true ???? ===+ Workgroups simply don't make sense over anything + else but port 139... cli_shutdown(cli); port = 139; cli = do_connect(query_host, "IPC$"); } - + if (cli == NULL) { d_printf("NetBIOS over TCP disabled -- no workgroup available\n"); return 1; } + */ list_servers(lp_workgroup()); @@ -2721,8 +2736,9 @@ zero_ip(&ip); if (have_ip) ip = dest_ip; - - if (!(cli=cli_initialise(NULL)) || (cli_set_port(cli, port) != port) || + + if (!(cli=cli_initialise(NULL)) || !(cli->timeout = connect_timeout) || + (cli_set_port(cli, port) != port) || !cli_connect(cli, server_name, &ip)) { d_printf("Connection to %s failed\n", desthost); return 1; @@ -2795,6 +2811,7 @@ { "command", 'c', POPT_ARG_STRING, &cmdstr, 'c', "Execute semicolon separated commands" }, { "send-buffer", 'b', POPT_ARG_INT, &io_bufsize, 'b', "Changes the transmit/send buffer", "BYTES" }, { "port", 'p', POPT_ARG_INT, &port, 'p', "Port to connect to", "PORT" }, + { "conn_timeout", 'e', POPT_ARG_INT, &connect_timeout, 'e', "Connection timeout in millisecond", "CONNTIMEOUT" }, POPT_COMMON_SAMBA POPT_COMMON_CONNECTION POPT_COMMON_CREDENTIALS