smbtorture failures in smb2.create.gentest

Steve French smfrench at gmail.com
Fri Mar 31 22:43:20 UTC 2017


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


More information about the samba-technical mailing list