[EXTERNAL] Re: Windows 10 client opens a folder as a file and asks for SMB2 GetInfo SMB2_FILE_STREAM_INFO

Ashok Ramakrishnan aramakrishnan at nasuni.com
Fri May 1 18:30:48 UTC 2020


Thanks Jeremy for the tip. Our customer is able to reproduce this readily. So, I can try potential patches. One interesting observation I have since you pointed out the Reparse Point bit... The previous getinfo command was file network open info. And we (samba) responding with this for the folder...

SMB2_FILE_NETWORK_OPEN_INFO
    Created: Nov  6, 2015 20:22:26.658586900 Eastern Standard Time
    Last Access: Nov  6, 2015 20:22:26.659295100 Eastern Standard Time
    Last Write: Nov  6, 2015 20:22:36.530589900 Eastern Standard Time
    Change: Nov  6, 2015 20:22:36.530589900 Eastern Standard Time
    Allocation Size: 0
    End Of File: 0
    File Attributes: 0x00000010
        .... .... .... .... .... .... .... ...0 = Read Only: NOT read only
        .... .... .... .... .... .... .... ..0. = Hidden: NOT hidden
        .... .... .... .... .... .... .... .0.. = System: NOT a system file/dir
        .... .... .... .... .... .... .... 0... = Volume ID: NOT a volume ID
        .... .... .... .... .... .... ...1 .... = Directory: DIRECTORY
        .... .... .... .... .... .... ..0. .... = Archive: Has NOT been modified since last archive
        .... .... .... .... .... .... .0.. .... = Device: NOT a device
        .... .... .... .... .... .... 0... .... = Normal: Has some attribute set
        .... .... .... .... .... ...0 .... .... = Temporary: NOT a temporary file
        .... .... .... .... .... ..0. .... .... = Sparse: NOT a sparse file
        .... .... .... .... .... .0.. .... .... = Reparse Point: Does NOT have an associated reparse point
        .... .... .... .... .... 0... .... .... = Compressed: Uncompressed
        .... .... .... .... ...0 .... .... .... = Offline: Online
        .... .... .... .... ..0. .... .... .... = Content Indexed: NOT content indexed
        .... .... .... .... .0.. .... .... .... = Encrypted: This is NOT an encrypted file
    Reserved: 00000000

We specifically said that it IS a Directory and NOT a reparse point. But the client still decided to send us a 0x00200020 in the subsequent open of the file. I can play with the response and see if I can get the client to behave differently...

Thanks,

-----Original Message-----
From: Jeremy Allison <jra at samba.org>
Sent: Friday, May 1, 2020 2:02 PM
To: Ashok Ramakrishnan <aramakrishnan at nasuni.com>; samba-technical at lists.samba.org
Subject: [EXTERNAL] Re: Windows 10 client opens a folder as a file and asks for SMB2 GetInfo SMB2_FILE_STREAM_INFO

On Fri, May 01, 2020 at 10:58:28AM -0700, Jeremy Allison via samba-technical wrote:
> On Fri, May 01, 2020 at 03:55:49PM +0000, Ashok Ramakrishnan via samba-technical wrote:
> > Hi:
> > We use 4.9.4 based samba in our product and one of our customers is running into a strange issue. If they right click on a folder and get the properties, it reports incorrect size information. When we looked at the network trace, we see that the client is walking the tree and getting information about files and folders.. Suddenly out of the blue, it opens a folder (which it had previous opened and closed as a directory) as a file (Create Options 0x00200020) and then issues a getino file stream info call. Samba promptly responds to this with NO_DATA since there is no stream associated with this folder. After this, things go downhill.. The client starts requesting files with paths without the above folder in the path and rightly gets STATUS_OBJECT_NAME_NOT_FOUND. We have requested our customer to open a support case with Microsoft to help understand the reason for the client behavior... But hoping someone here has had experience troubleshooting similar issues and can provide some tips/pointers on what to look for. I am primarily trying to figure out what could prompt the client to open a folder it knows is a folder, as a file and ask for the stream info. I have looked through the file ID, QFid, etc for any duplication and could not find any. So, why would the client do this? And it does not do this for 99% of the folders in the tree.. Just for a few...
> >
> > Thanks!
> >
> >
> > -----------
> > Frame showing the path being opened as a directory...
> >
> > Frame 65257: 706 bytes on wire (5648 bits), 706 bytes captured (5648
> > bits) on interface \Device\NPF_{B68E32C7-33A6-49BB-BD17-84680A37AE6E}, id 0 ...
> >
> > Then the client does a SMB2_FIND_ID_BOTH_DIRECTORY_INFO to list the contents of the directory...followed by this...It opens the same path without explicitly asking to open a directory (Neither 0x20 not 0x40 is set in the Create Options).
> >
> > ----------------
> > Frame 65263: 682 bytes on wire (5456 bits), 682 bytes captured (5456
> > bits) on interface \Device\NPF_{B68E32C7-33A6-49BB-BD17-84680A37AE6E}, id 0 ...
> > Transmission Control Protocol, Src Port: 63880, Dst Port: 445, Seq:
> > 5539052, Ack: 5900825, Len: 628 NetBIOS Session Service
> > SMB2 (Server Message Block Protocol version 2)
> >     SMB2 Header
> >         ProtocolId: 0xfe534d42
> >         Header Length: 64
> >         Credit Charge: 1
> >         Channel Sequence: 0
> >         Reserved: 0000
> >         Command: Create (5)
> >         Credits requested: 0
> >         Flags: 0x00000010, Priority
> >         Chain Offset: 0x00000208
> >         Message ID: Unknown (65656)
> >         Process Id: 0x0000feff
> >         Tree Id: 0x12c24d77
> >         Session Id: 0x00000000771ae25b
> >         Signature: 00000000000000000000000000000000
> >         [Response in: 65264]
> >     Create Request (0x05)
> >         StructureSize: 0x0039
> >         Oplock: No oplock (0x00)
> >         Impersonation level: Impersonation (2)
> >         Create Flags: 0x0000000000000000
> >         Reserved: 0000000000000000
> >         Access Mask: 0x00100080
> >         File Attributes: 0x00000080
> >         Share Access: 0x00000007, Read, Write, Delete
> >         Disposition: Open (if file exists open it, else fail) (1)
> >         Create Options: 0x00200020
>
> This is the key field. It's asking for a reparse point:
>
> FILE_OPEN_REPARSE_POINT 0x00200000
>
> which we're just ignoring. We probably shouldn't.

Or maybe we should :-). MS-SMB2 states:

FILE_OPEN_REPARSE_POINT
0x00200000 If the file or directory being opened is a reparse point, open the reparse point itself rather than the target that the reparse point references.

which implies that if it's not a reparse point we should just open the underlying object, not fail it (which we do).

torture tests against Windows10 needed here I think.
This e-mail message and all attachments transmitted with it may contain privileged and/or confidential information intended solely for the use of the addressee(s). If the reader of this message is not the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying, forwarding or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately and delete this message, all attachments and all copies and backups thereof.



More information about the samba-technical mailing list