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;
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;
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;
}
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;
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) {
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);
"%s", share);
} else {
slprintf(fullshare, sizeof(fullshare)-1,
- "\\\\%s\\%s", "foo", share);
+ "\\\\%s\\%s", cli->desthost, share);
}
set_message(cli->outbuf,4, 0, True);
*/
int cli_set_port(struct cli_state *cli, int port)
{
- if (port > 0)
- cli->port = port;
-
- return cli->port;
+ cli->port = port;
+ return port;
}
/****************************************************************************
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;
}
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;
}
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;
}
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);