1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-10 12:58:35 +03:00

r22924: Fix the build by correctly processing readX

errors in the direct read case.
Jeremy.
(This used to be commit 6fe2ee3bd79fadfe43a9a84e03c398bd339259c1)
This commit is contained in:
Jeremy Allison 2007-05-16 01:34:22 +00:00 committed by Gerald (Jerry) Carter
parent 51101a9450
commit bfb863c57c

View File

@ -249,31 +249,35 @@ 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)) {
/*
* We're not coping here with asnyc replies to
* other calls. Punt here - we need async client
* libs for this.
*/
goto read_err;
}
/* If it's not the above size it probably was an error packet. */
/*
* 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) {
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 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;
}
}
}
return True;