r22950: Fix the issue Volker reported here :
authorJeremy Allison <jra@samba.org>
Wed, 16 May 2007 17:17:25 +0000 (17:17 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:22:11 +0000 (12:22 -0500)
"Attempt to fix some build farm failures: On port 139 the first
successful packet gives len==0 from the server, so the = in

        if (len <= 0) {

in line 136 of clientgen.c throws a failure."

The irritating thing is that I already had it correct in
SAMBA_3_0_26 and forgot to merge the change across.

len == 0 is a valid return - I messed that up when
converting client_receive_smb() to return a length
rather than a BOOL.

Doh !

Jeremy.

source/libsmb/cliconnect.c
source/libsmb/clientgen.c

index f13aa21fbdd88c0f5867c5f9a12ec0fd1590eff4..86834ad081b6fd7508d0ba60c20d442d8a5adf25 100644 (file)
@@ -1347,7 +1347,7 @@ BOOL cli_session_request(struct cli_state *cli,
        cli_send_smb(cli);
        DEBUG(5,("Sent session request\n"));
 
-       if (!cli_receive_sessionreply(cli))
+       if (!cli_receive_smb(cli))
                return False;
 
        if (CVAL(cli->inbuf,0) == 0x84) {
index ef74de9f4ba26b9f35bb96b5f9a7c32a0f2c6fbf..43211a6c5a8eb99e251b01aecf8fad2e4f6ab435 100644 (file)
@@ -133,7 +133,7 @@ BOOL cli_receive_smb_internal(struct cli_state *cli, BOOL eat_keepalives)
        }
 
        /* If the server is not responding, note that now */
-       if (len <= 0) {
+       if (len < 0) {
                 DEBUG(0, ("Receiving SMB: Server stopped responding\n"));
                cli->smb_rw_error = smb_read_error;
                close(cli->fd);
@@ -190,32 +190,6 @@ BOOL cli_receive_smb_return_keepalive(struct cli_state *cli)
        return cli_receive_smb_internal(cli, False);
 }
 
-/****************************************************************************
- Recv an smb session reply
-****************************************************************************/
-
-BOOL cli_receive_sessionreply(struct cli_state *cli)
-{
-       ssize_t len;
-
-       /* fd == -1 causes segfaults -- Tom (tom@ninja.nl) */
-       if (cli->fd == -1)
-               return False; 
-
-       len = client_receive_smb(cli, False, 0);
-
-       /* If the server is not responding, note that now */
-       if (len < 0) {
-                DEBUG(0, ("Receiving SMB: Server stopped responding\n"));
-               cli->smb_rw_error = smb_read_error;
-               close(cli->fd);
-               cli->fd = -1;
-               return False;
-       }
-
-       return True;
-}
-
 /****************************************************************************
  Read the data portion of a readX smb.
  The timeout is in milliseconds