summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-08-24 20:11:09 +0000
committerAndrew Tridgell <tridge@samba.org>2001-08-24 20:11:09 +0000
commit464237cdb8d4f4c4c93d9cf24f38f2720ea99b9c (patch)
treef0d1b43ceb06b275bf399583119a8f76e9810813
parent1399170a7716ba9ca2d71ef7f0e68d132a4172b4 (diff)
downloadsamba-464237cdb8d4f4c4c93d9cf24f38f2720ea99b9c.tar.gz
samba-464237cdb8d4f4c4c93d9cf24f38f2720ea99b9c.tar.bz2
samba-464237cdb8d4f4c4c93d9cf24f38f2720ea99b9c.zip
fixed handling of 139/445 in clients
(This used to be commit 22b372f8a7996a19bebb8cdb411df999cffa32a4)
-rw-r--r--source3/client/client.c6
-rw-r--r--source3/client/smbmount.c4
-rw-r--r--source3/client/smbspool.c6
-rw-r--r--source3/libsmb/cliconnect.c2
-rw-r--r--source3/libsmb/clientgen.c6
-rw-r--r--source3/torture/locktest.c3
-rw-r--r--source3/torture/locktest2.c3
-rw-r--r--source3/torture/masktest.c3
-rw-r--r--source3/utils/smbcacls.c3
9 files changed, 12 insertions, 24 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 29e23654fb..88191347b1 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -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;
}
diff --git a/source3/client/smbmount.c b/source3/client/smbmount.c
index d0c18e6134..71c7e29810 100644
--- a/source3/client/smbmount.c
+++ b/source3/client/smbmount.c
@@ -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) {
diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c
index 0c21399e96..69454825f8 100644
--- a/source3/client/smbspool.c
+++ b/source3/client/smbspool.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);
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 1628139dd9..8230edbd63 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -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);
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 5ddfa48ac0..b3933f41e0 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -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;
}
/****************************************************************************
diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c
index 4c62b8dafc..82eee773f2 100644
--- a/source3/torture/locktest.c
+++ b/source3/torture/locktest.c
@@ -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;
}
diff --git a/source3/torture/locktest2.c b/source3/torture/locktest2.c
index 37baa62b73..ce988f0cc8 100644
--- a/source3/torture/locktest2.c
+++ b/source3/torture/locktest2.c
@@ -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;
}
diff --git a/source3/torture/masktest.c b/source3/torture/masktest.c
index 92fa427a1f..93caf5d017 100644
--- a/source3/torture/masktest.c
+++ b/source3/torture/masktest.c
@@ -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;
}
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index 20333f772b..9e8cbb1ddd 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -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);