mirror of
https://github.com/samba-team/samba.git
synced 2025-02-23 09:57:40 +03:00
fixed handling of 139/445 in clients
This commit is contained in:
parent
55f222236f
commit
22b372f8a7
@ -29,7 +29,7 @@
|
||||
|
||||
struct cli_state *cli;
|
||||
extern BOOL in_client;
|
||||
static int port = SMB_PORT;
|
||||
static int port = 0;
|
||||
pstring cur_dir = "\\";
|
||||
pstring cd_path = "";
|
||||
static pstring service;
|
||||
@ -1995,7 +1995,7 @@ struct cli_state *do_connect(const char *server, const char *share)
|
||||
if (have_ip) ip = dest_ip;
|
||||
|
||||
/* have to open a new connection */
|
||||
if (!(c=cli_initialise(NULL)) || (cli_set_port(c, port) == 0) ||
|
||||
if (!(c=cli_initialise(NULL)) || (cli_set_port(c, port) != port) ||
|
||||
!cli_connect(c, server_n, &ip)) {
|
||||
DEBUG(0,("Connection to %s failed\n", server_n));
|
||||
return NULL;
|
||||
@ -2253,7 +2253,7 @@ static int do_message_op(void)
|
||||
ip = ipzero;
|
||||
if (have_ip) ip = dest_ip;
|
||||
|
||||
if (!(cli=cli_initialise(NULL)) || (cli_set_port(cli, port) == 0) || !cli_connect(cli, desthost, &ip)) {
|
||||
if (!(cli=cli_initialise(NULL)) || (cli_set_port(cli, port) != port) || !cli_connect(cli, desthost, &ip)) {
|
||||
DEBUG(0,("Connection to %s failed\n", desthost));
|
||||
return 1;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ static pstring options;
|
||||
|
||||
static struct in_addr dest_ip;
|
||||
static BOOL have_ip;
|
||||
static int smb_port = 139;
|
||||
static int smb_port = 0;
|
||||
static BOOL got_pass;
|
||||
static uid_t mount_uid;
|
||||
static gid_t mount_gid;
|
||||
@ -148,7 +148,7 @@ static struct cli_state *do_connection(char *service)
|
||||
if (have_ip) ip = dest_ip;
|
||||
|
||||
/* have to open a new connection */
|
||||
if (!(c=cli_initialise(NULL)) || (cli_set_port(c, smb_port) == 0) ||
|
||||
if (!(c=cli_initialise(NULL)) || (cli_set_port(c, smb_port) != port) ||
|
||||
!cli_connect(c, server_n, &ip)) {
|
||||
DEBUG(0,("%d: Connection to %s failed\n", getpid(), server_n));
|
||||
if (c) {
|
||||
|
@ -302,12 +302,6 @@ smb_connect(char *workgroup, /* I - Workgroup */
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (!cli_set_port(c, SMB_PORT))
|
||||
{
|
||||
fputs("ERROR: cli_set_port() failed...\n", stderr);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (!cli_connect(c, server, &ip))
|
||||
{
|
||||
fputs("ERROR: cli_connect() failed...\n", stderr);
|
||||
|
@ -274,7 +274,7 @@ BOOL cli_send_tconX(struct cli_state *cli,
|
||||
"%s", share);
|
||||
} else {
|
||||
slprintf(fullshare, sizeof(fullshare)-1,
|
||||
"\\\\%s\\%s", "foo", share);
|
||||
"\\\\%s\\%s", cli->desthost, share);
|
||||
}
|
||||
|
||||
set_message(cli->outbuf,4, 0, True);
|
||||
|
@ -31,10 +31,8 @@ extern int DEBUGLEVEL;
|
||||
*/
|
||||
int cli_set_port(struct cli_state *cli, int port)
|
||||
{
|
||||
if (port > 0)
|
||||
cli->port = port;
|
||||
|
||||
return cli->port;
|
||||
cli->port = port;
|
||||
return port;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -139,8 +139,7 @@ struct cli_state *connect_one(char *share)
|
||||
ip = ipzero;
|
||||
|
||||
/* have to open a new connection */
|
||||
if (!(c=cli_initialise(NULL)) || (cli_set_port(c, 139) == 0) ||
|
||||
!cli_connect(c, server_n, &ip)) {
|
||||
if (!(c=cli_initialise(NULL)) || !cli_connect(c, server_n, &ip)) {
|
||||
DEBUG(0,("Connection to %s failed\n", server_n));
|
||||
return NULL;
|
||||
}
|
||||
|
@ -180,8 +180,7 @@ struct cli_state *connect_one(char *share)
|
||||
ip = ipzero;
|
||||
|
||||
/* have to open a new connection */
|
||||
if (!(c=cli_initialise(NULL)) || (cli_set_port(c, 139) == 0) ||
|
||||
!cli_connect(c, server_n, &ip)) {
|
||||
if (!(c=cli_initialise(NULL)) || !cli_connect(c, server_n, &ip)) {
|
||||
DEBUG(0,("Connection to %s failed\n", server_n));
|
||||
return NULL;
|
||||
}
|
||||
|
@ -185,8 +185,7 @@ struct cli_state *connect_one(char *share)
|
||||
ip = ipzero;
|
||||
|
||||
/* have to open a new connection */
|
||||
if (!(c=cli_initialise(NULL)) || (cli_set_port(c, 139) == 0) ||
|
||||
!cli_connect(c, server_n, &ip)) {
|
||||
if (!(c=cli_initialise(NULL)) || !cli_connect(c, server_n, &ip)) {
|
||||
DEBUG(0,("Connection to %s failed\n", server_n));
|
||||
return NULL;
|
||||
}
|
||||
|
@ -711,8 +711,7 @@ struct cli_state *connect_one(char *share)
|
||||
ip = ipzero;
|
||||
|
||||
/* have to open a new connection */
|
||||
if (!(c=cli_initialise(NULL)) || (cli_set_port(c, 139) == 0) ||
|
||||
!cli_connect(c, server, &ip)) {
|
||||
if (!(c=cli_initialise(NULL)) || !cli_connect(c, server, &ip)) {
|
||||
DEBUG(0,("Connection to %s failed\n", server));
|
||||
cli_shutdown(c);
|
||||
safe_free(c);
|
||||
|
Loading…
x
Reference in New Issue
Block a user