s3:libsmb: make sure have_andx_command() returns false for non AndX commands
authorStefan Metzmacher <metze@samba.org>
Mon, 7 Nov 2011 07:54:40 +0000 (08:54 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 7 Nov 2011 08:18:18 +0000 (09:18 +0100)
metze

source3/libsmb/async_smb.c

index 801efe4dd97707c06a301fcd1fa89c6455603704..26f4b30ce1be62a63855130249588137b82b4e53 100644 (file)
@@ -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(