From 597f2ae3423ce70f84e41ed3293f049920fa0758 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 7 Nov 2011 08:54:40 +0100 Subject: s3:libsmb: make sure have_andx_command() returns false for non AndX commands metze --- source3/libsmb/async_smb.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c index 801efe4dd9..26f4b30ce1 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( -- cgit