From: Stefan Metzmacher Date: Mon, 7 Nov 2011 07:54:40 +0000 (+0100) Subject: s3:libsmb: make sure have_andx_command() returns false for non AndX commands X-Git-Url: http://git.samba.org/samba.git/?a=commitdiff_plain;h=597f2ae3423ce70f84e41ed3293f049920fa0758;p=ira%2Fwip.git s3:libsmb: make sure have_andx_command() returns false for non AndX commands metze --- diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c index 801efe4dd97..26f4b30ce1b 100644 --- a/source3/libsmb/async_smb.c +++ b/source3/libsmb/async_smb.c @@ -51,11 +51,15 @@ static NTSTATUS cli_pull_raw_error(const uint8_t *buf) * @retval Is there a command following? */ -static bool have_andx_command(const char *buf, uint16_t ofs) +static bool have_andx_command(const char *buf, uint16_t ofs, uint8_t cmd) { uint8_t wct; size_t buflen = talloc_get_size(buf); + if (!is_andx_req(cmd)) { + return false; + } + if ((ofs == buflen-1) || (ofs == buflen)) { return false; } @@ -870,7 +874,7 @@ NTSTATUS cli_smb_recv(struct tevent_req *req, } } - if (!have_andx_command((char *)state->inbuf, wct_ofs)) { + if (!have_andx_command((char *)state->inbuf, wct_ofs, cmd)) { /* * This request was not completed because a previous * request in the chain had received an error. @@ -907,7 +911,7 @@ NTSTATUS cli_smb_recv(struct tevent_req *req, status = state->cli->raw_status; } - if (!have_andx_command((char *)state->inbuf, wct_ofs)) { + if (!have_andx_command((char *)state->inbuf, wct_ofs, cmd)) { if ((cmd == SMBsesssetupX) && NT_STATUS_EQUAL(