summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-05-16 01:34:22 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:22:08 -0500
commitbfb863c57cd1b8fc16cf7cda3cc3989104b4246c (patch)
treeafb968264a039c4d9ddca3ae359ffdb98e44c7eb
parent51101a94505c16bb8c429e8f10ee1eaa85ffc5e0 (diff)
downloadsamba-bfb863c57cd1b8fc16cf7cda3cc3989104b4246c.tar.gz
samba-bfb863c57cd1b8fc16cf7cda3cc3989104b4246c.tar.bz2
samba-bfb863c57cd1b8fc16cf7cda3cc3989104b4246c.zip
r22924: Fix the build by correctly processing readX
errors in the direct read case. Jeremy. (This used to be commit 6fe2ee3bd79fadfe43a9a84e03c398bd339259c1)
-rw-r--r--source3/libsmb/clientgen.c46
1 files changed, 25 insertions, 21 deletions
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 1a4b1f770f..9021d1a362 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -249,30 +249,34 @@ BOOL cli_receive_smb_readX_header(struct cli_state *cli)
}
}
- /* Check it's a non-chained readX reply. */
- if (!(CVAL(cli->inbuf, smb_flg) & FLAG_REPLY) ||
- (CVAL(cli->inbuf,smb_vwv0) != 0xFF) ||
- (CVAL(cli->inbuf,smb_com) != SMBreadX)) {
+ /* If it's not the above size it probably was an error packet. */
+
+ if ((len == (smb_size - 4) + 24) && !cli_is_error(cli)) {
+ /* Check it's a non-chained readX reply. */
+ if (!(CVAL(cli->inbuf, smb_flg) & FLAG_REPLY) ||
+ (CVAL(cli->inbuf,smb_vwv0) != 0xFF) ||
+ (CVAL(cli->inbuf,smb_com) != SMBreadX)) {
+ /*
+ * We're not coping here with asnyc replies to
+ * other calls. Punt here - we need async client
+ * libs for this.
+ */
+ goto read_err;
+ }
+
/*
- * We're not coping here with asnyc replies to
- * other calls. Punt here - we need async client
- * libs for this.
+ * We know it's a readX reply - ensure we've read the
+ * padding bytes also.
*/
- goto read_err;
- }
- /*
- * We know it's a readX reply - ensure we've read the
- * padding bytes also.
- */
-
- offset = SVAL(cli->inbuf,smb_vwv6);
- if (offset > len) {
- ssize_t ret;
- size_t padbytes = offset - len;
- ret = cli_receive_smb_data(cli,smb_buf(cli->inbuf),padbytes);
- if (ret != padbytes) {
- goto read_err;
+ offset = SVAL(cli->inbuf,smb_vwv6);
+ if (offset > len) {
+ ssize_t ret;
+ size_t padbytes = offset - len;
+ ret = cli_receive_smb_data(cli,smb_buf(cli->inbuf),padbytes);
+ if (ret != padbytes) {
+ goto read_err;
+ }
}
}