fixed handling of 139/445 in clients
authorAndrew Tridgell <tridge@samba.org>
Fri, 24 Aug 2001 20:11:09 +0000 (20:11 +0000)
committerAndrew Tridgell <tridge@samba.org>
Fri, 24 Aug 2001 20:11:09 +0000 (20:11 +0000)
(This used to be commit 22b372f8a7996a19bebb8cdb411df999cffa32a4)

source3/client/client.c
source3/client/smbmount.c
source3/client/smbspool.c
source3/libsmb/cliconnect.c
source3/libsmb/clientgen.c
source3/torture/locktest.c
source3/torture/locktest2.c
source3/torture/masktest.c
source3/utils/smbcacls.c

index 29e23654fb09e273247972e5a65b99976854c0a8..88191347b1fdddf67135458356da992fc3acde85 100644 (file)
@@ -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;
        }
index d0c18e6134bbcc7377fdb6a5d035c521751a2541..71c7e298106af245bdd966db9d769577fcf39685 100644 (file)
@@ -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) {
index 0c21399e967ff23ca96646ab4528ace464ea9bf4..69454825f803e4096107dc4248fb66bb7a348ce1 100644 (file)
@@ -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);
index 1628139dd92bf85ab9be66bd4b8d760265bfecd6..8230edbd632edad5ed8c4e248f9e2ff6d6f1991d 100644 (file)
@@ -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);
index 5ddfa48ac0f4ad10a72bf6f5026b730fcc517e71..b3933f41e0208850107143056cedd32e69b891f9 100644 (file)
@@ -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;
 }
 
 /****************************************************************************
index 4c62b8dafc20211924492b6b422b05985cc3d981..82eee773f2d92f8f1ba5f88fffed51a4bba549bc 100644 (file)
@@ -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;
        }
index 37baa62b73f2a1be8df004d7c493a3a68ac5f98f..ce988f0cc8ac7eddeac5e5a8696082e8085d3025 100644 (file)
@@ -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;
        }
index 92fa427a1f9f6e6002b525eeda37244f32761e35..93caf5d017203b68f63940ae02251bd514f721a2 100644 (file)
@@ -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;
        }
index 20333f772b481c7f7a0490304c0b668dfc233713..9e8cbb1ddd11b35fe63e3a57edf53cd69670f818 100644 (file)
@@ -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);