Created attachment 15251 [details]
Fake Directory Leases
macOS SMB server and Samba with fruit do a validity check on the data written to the AFP_AfpInfo stream.
Invalid data, eg where the the first three bytes do not contain the magic string "AFP" cause a write on this stream to fail with NT_STATUS_INVALID_PARAMETER.
macOS SMB server also support Directory Leases since 10.13. When the Windows client receives the error for the write from a macOS server, the Windows Explorer hides the error from the user *if the server supports Directory Leases*.
Steps to reproduce:
* Windows client connected to macOS SMB 10.13 (or newer)
* file on the client with an associated stream "AFP_AfpInfo" with invalid data
* in Windows Explorer copy file to server
* copy succeeds, no user visible error
* disconnect Windows client from macOS SMB server, connect to Samba (with fruit+streams_xattr)
* copy file to server
* copy fails
Adding a fake Directory Leases implementation lets the copy pass.
We have done some testing with this patch and noticed that Windows Clients connected to the same share do not receive folder/file updates from another client.
1. Client A connects to share X.
2. Client B connects to share X.
3. Client A creates a new file.
4. Client B does not detect the new file is there for ~10 minutes or disconnect/reconnect.
5. Client B deletes the file.
6. Client A does not detect the file is deleted until attempting to open the file or ~10 minutes.
I would strongly caution against using this patch at this time.
(In reply to Nathan Palmer from comment #1)
Heavens, the patch description clearly says "Fake directory leases" and the patch subject contains "HACK", so yes, you're NOT supposed to run this patch in production. :)
Just making it explicitly obvious with a test scenario to showcase :)
We are currently testing an in house patch that may resolve this problem. Once we complete testing we will update and let you know.