s3-smb2_server: fix ioctl InputOffset checking
authorDavid Disseldorp <ddiss@suse.de>
Wed, 28 Sep 2011 12:45:42 +0000 (14:45 +0200)
committerDavid Disseldorp <ddiss@samba.org>
Thu, 29 Sep 2011 11:14:21 +0000 (13:14 +0200)
Currently the InputOffset is always check to point to the input data
buffer, regardless of whether input data is present.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/smbd/smb2_ioctl.c

index 491c3fd9cc0f9d75e0d288c4a994ea64c11d77dd..5a766e1b1a52acfaca10ddad3520881339274de0 100644 (file)
@@ -68,7 +68,16 @@ NTSTATUS smbd_smb2_request_process_ioctl(struct smbd_smb2_request *req)
        in_max_output_length    = IVAL(inbody, 0x2C);
        in_flags                = IVAL(inbody, 0x30);
 
-       if (in_input_offset != (SMB2_HDR_BODY + req->in.vector[i+1].iov_len)) {
+       /*
+        * InputOffset (4 bytes): The offset, in bytes, from the beginning of
+        * the SMB2 header to the input data buffer. If no input data is
+        * required for the FSCTL/IOCTL command being issued, the client SHOULD
+        * set this value to 0.<49>
+        * <49> If no input data is required for the FSCTL/IOCTL command being
+        * issued, Windows-based clients set this field to any value.
+        */
+       if ((in_input_length > 0)
+        && (in_input_offset != (SMB2_HDR_BODY + req->in.vector[i+1].iov_len))) {
                return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
        }