summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-05-16 09:53:41 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:22:10 -0500
commitcc5c058e5992ae8209caaf8ff63d03eff686ce50 (patch)
tree20be44f19b29950b2682180bcd7ae7d21bc0f771
parent3c5fe9233d1c3679be24dbb462fb38a5c650b68c (diff)
downloadsamba-cc5c058e5992ae8209caaf8ff63d03eff686ce50.tar.gz
samba-cc5c058e5992ae8209caaf8ff63d03eff686ce50.tar.bz2
samba-cc5c058e5992ae8209caaf8ff63d03eff686ce50.zip
r22929: 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. Jeremy, please fix this properly, I'm not merging this to 3_0_26 so that you can filter it when you merge. Volker (This used to be commit 9c5111d8c5064a43762d7d0146acff5e7691dafd)
-rw-r--r--source3/libsmb/cliconnect.c2
-rw-r--r--source3/libsmb/clientgen.c26
2 files changed, 27 insertions, 1 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 86834ad081..f13aa21fbd 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -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_smb(cli))
+ if (!cli_receive_sessionreply(cli))
return False;
if (CVAL(cli->inbuf,0) == 0x84) {
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 9021d1a362..92a9678de5 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -191,6 +191,32 @@ BOOL cli_receive_smb_return_keepalive(struct cli_state *cli)
}
/****************************************************************************
+ 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
****************************************************************************/