smbtorture failures in smb2.create.gentest

Steve French smfrench at gmail.com
Sat Apr 1 02:13:51 UTC 2017


Slightly updated patch, gets farther (matches Windows behavior in my tests
to Windows 2012R2 and Windows 8.1)

sfrench at ubuntu:~/samba$ smbtorture //localhost/test -U admin%admin
smb2.create.gentest
smbtorture 4.3.11-Ubuntu
Using seed 1490975059
time: 2017-03-31 10:44:19.129162
test: gentest
time: 2017-03-31 10:44:19.129525
time: 2017-03-31 10:44:19.401920
failure: gentest [
(../source4/torture/smb2/create.c:252) Incorrect value for access_mask
0x0de0fe00 - should be 0x0df0fe00
]


diff --git a/source3/include/smb.h b/source3/include/smb.h
index cc00e87..8ecd5db 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -404,8 +404,8 @@ Offset  Data                        length.
 #define EXTENDED_RESPONSE_REQUIRED 0x10

 #define NTCREATEX_OPTIONS_MUST_IGNORE_MASK      (0x008F0480)
-
-#define NTCREATEX_OPTIONS_INVALID_PARAM_MASK    (0xFF100030)
+#define NTCREATEX_OPTIONS_NOT_SUPPORTED_MASK    (0x00102080)
+#define NTCREATEX_OPTIONS_INVALID_PARAM_MASK    (0xFF100080)

 /*
  * Private create options used by the ntcreatex processing code. From
Samba4.
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 3368bae..30ce897 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -4992,11 +4992,28 @@ static NTSTATUS
create_file_unixpath(connection_struct *conn,
                goto fail;
        }

+       if (create_options & NTCREATEX_OPTIONS_NOT_SUPPORTED_MASK) {
+               /* See note 35 of MS-SMB2 Section 2.2.13 */
+               status = NT_STATUS_NOT_SUPPORTED;
+               goto fail;
+       }
+
        if (create_options & NTCREATEX_OPTIONS_INVALID_PARAM_MASK) {
                status = NT_STATUS_INVALID_PARAMETER;
                goto fail;
        }

+       if (access_mask & 0x0C000000) {
+               status = NT_STATUS_ACCESS_DENIED;
+               goto fail;
+       }
+
+       if ((file_attributes & FILE_ATTRIBUTE_DEVICE) ||
+           (file_attributes & FILE_ATTRIBUTE_VOLUME)) {
+               status = NT_STATUS_INVALID_PARAMETER;
+               goto fail;
+       }
+
        if (req == NULL) {
                oplock_request |= INTERNAL_OPEN_ONLY;
        }


On Fri, Mar 31, 2017 at 5:43 PM, Steve French <smfrench at gmail.com> wrote:

> Well ... the torture test fails to Samba and works to Windows (almost - it
> fails near the end for an unrelated reason).
>
>
> Before the fix there are three failures early on, on line 164 of
> torture/smb2/create.c (server is current Samba 4-5.test), with the fix it
> goes MUCH farther (see below).  With Windows (tested to Windows 8.1, might
> work to Windows 2016?) it goes almost to the end (gentest test case bug?).
> To Windows  "(../source4/torture/smb2/create.c:252) Incorrect value for
> access_mask 0x0de0fe00 - should be 0x0df0fe00"
>
> Without my fix smb2.create.gentest fails three different ways less than
> 1/2 way through (on line 155 of the test)
>
> To Samba with my fix it is better:
>
> sfrench at ubuntu:~$ smbtorture //localhost/test -U admin%admin
> smb2.create.gentest
> smbtorture 4.3.11-Ubuntu
> Using seed 1490962005
> time: 2017-03-31 07:06:45.659712
> test: gentest
> time: 2017-03-31 07:06:45.660063
> time: 2017-03-31 07:06:45.830428
> failure: gentest [
> (../source4/torture/smb2/create.c:222) Incorrect value for ok_mask
> 0x00efcffe - should be 0x00efcf7e
>
> The slightly updated version of my fix is below:
>
> diff --git a/source3/smbd/open.c b/source3/smbd/open.c
> index 3368bae..35cc38a 100644
> --- a/source3/smbd/open.c
> +++ b/source3/smbd/open.c
> @@ -4997,6 +4997,17 @@ static NTSTATUS create_file_unixpath(connection_struct
> *conn,
>                 goto fail;
>         }
>
> +       if (access_mask & 0x0C000000) {
> +               status = NT_STATUS_ACCESS_DENIED;
> +               goto fail;
> +       }
> +
> +       if ((file_attributes & FILE_ATTRIBUTE_DEVICE) ||
> +           (file_attributes & FILE_ATTRIBUTE_VOLUME)) {
> +               status = NT_STATUS_INVALID_PARAMETER;
> +               goto fail;
> +       }
> +
>         if (req == NULL) {
>                 oplock_request |= INTERNAL_OPEN_ONLY;
>         }
>
>
> On Fri, Mar 31, 2017 at 5:06 PM, Jeremy Allison <jra at samba.org> wrote:
>
>> On Fri, Mar 31, 2017 at 01:26:05AM -0500, Steve French via
>> samba-technical wrote:
>> > I noticed that smbtorture smb2.create.gentest fails for multiple
>> reasons to
>> > Samba (but gets much farther to Windows).   Samba looks like it is is
>> > missing at least three checks during open:
>> >
>> > Thoughts on adding something similar to the following (so that
>> > smb2.create.gentest would pass and our behavior would better match
>> windows
>> > in validating opens):
>> >
>> > sfrench at ubuntu:~/samba/source3$ git diff -a
>> > diff --git a/source3/smbd/open.c b/source3/smbd/open.c
>> > index 3368bae..4a5ff87 100644
>> > --- a/source3/smbd/open.c
>> > +++ b/source3/smbd/open.c
>> > @@ -4997,6 +4997,17 @@ static NTSTATUS
>> > create_file_unixpath(connection_struct *c
>> >                 goto fail;
>> >         }
>> >
>> > +       if ((file_attributes & FILE_ATTRIBUTE_DEVICE) ||
>> > +           (file_attributes & FILE_ATTRIBUTE_VOLUME)) {
>> > +               status = NT_STATUS_INVALID_PARAMETER;
>> > +               goto fail;
>> > +       }
>> > +
>> > +       if (access_mask & 0x0C000000) {
>> > +               status = NT_STATUS_ACCESS_DENIED;
>> > +               goto fail;
>> > +       }
>> > +
>> >         if (req == NULL) {
>> >                 oplock_request |= INTERNAL_OPEN_ONLY;
>> >         }
>>
>> Hmmmm. Maybe. Before adding this we'd need torture
>> tests that pass against Windows that show the same
>> error returns..
>>
>
>
>
> --
> Thanks,
>
> Steve
>



-- 
Thanks,

Steve


More information about the samba-technical mailing list