Bug 6494 - Incorrect FileStatus returned in NT_CREATE_ANDX
Summary: Incorrect FileStatus returned in NT_CREATE_ANDX
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.5
Classification: Unclassified
Component: File services (show other bugs)
Version: unspecified
Hardware: x86 Windows 7
: P3 normal
Target Milestone: ---
Assignee: Volker Lendecke
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-22 18:04 UTC by Long Li
Modified: 2010-05-27 04:21 UTC (History)
2 users (show)

See Also:


Attachments
Patch for 3.5.0. (2.22 KB, patch)
2009-09-14 17:32 UTC, Jeremy Allison
vl: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Long Li 2009-06-22 18:04:41 UTC
The SMBD server uses the following code snippet to create a NT_CREATE_ANDX response:

("smbd/nttrans.c" line 617 of 2926, in void reply_ntcreate_and_X())

        put_long_date_timespec(p, c_timespec); /* create time. */
        p += 8;
        put_long_date_timespec(p, a_timespec); /* access time */
        p += 8;
        put_long_date_timespec(p, m_timespec); /* write time */
        p += 8;
        put_long_date_timespec(p, m_timespec); /* change time */
        p += 8;
        SIVAL(p,0,fattr); /* File Attributes. */
        p += 4;
        SOFF_T(p, 0, SMB_VFS_GET_ALLOC_SIZE(conn,fsp,&sbuf));
        p += 8;
        SOFF_T(p,0,file_len);
        p += 8;
        if (flags & EXTENDED_RESPONSE_REQUIRED) {
                SSVAL(p,2,0x7);
        }

In the last 4 lines, it always sets FileStatus to 0x7. 0x7 means NoEAs and NoSubstreams. The server should set FileStatus flags to correct values if the file opened has extended attributes or substreams.

This bug was found using Microsoft internal common file system test tools.
Comment 1 Jeremy Allison 2009-06-23 15:09:44 UTC
Very interesting - thanks ! Can you point me at the protocol documentation that includes the bits NoEAs and NoSubstreams. It doesn't seem to be in the new CIFS doc that was published recently. Once I know what these bits mean I'll be able to set them appropriately.

Thanks,

Jeremy.
Comment 2 Long Li 2009-06-23 15:35:57 UTC
The documentation for the FileStatus flags is in section 2.2.9 of [MS-SMB]

http://msdn.microsoft.com/en-us/library/cc246334(PROT.13).aspx

Please refer to DeviceState_or_FileStatusFlags (2 bytes)

Thanks,

Long
Comment 3 Jeremy Allison 2009-06-23 21:02:27 UTC
Thanks - I was looking in the recently released CIFS guide on MSDN and it isn't there. I don't think this will make 3.4.0, but should be in the release after.

Cheers,

Jeremy.
Comment 4 Jeremy Allison 2009-09-14 17:32:17 UTC
Created attachment 4691 [details]
Patch for 3.5.0.

Fix that will be in 3.5.0 (not planning to backport to 3.4.2). Volker please review.
Jeremy.
Comment 5 Volker Lendecke 2010-01-20 06:21:57 UTC
Comment on attachment 4691 [details]
Patch for 3.5.0.

If it is survives make test then please put it in. Yet another one that will make us slower and slower and slower for the sake of 100% protocol correctness.
Comment 6 Karolin Seeger 2010-03-30 09:44:59 UTC
Jeremy, Volker:
What shall we do with this patch?
Comment 7 Jeremy Allison 2010-03-30 17:56:58 UTC
I'll update this and put it in master, not for 3.5.2. Let's target it for 3.6.0.

Jeremy.
Comment 8 Jeremy Allison 2010-03-30 17:59:53 UTC
Oh, never mind - it's already in master.
Jeremy.
Comment 9 Karolin Seeger 2010-05-27 04:21:45 UTC
(In reply to comment #8)
> Oh, never mind - it's already in master.
> Jeremy.
> 

Okay, so the bug report can be closed.