SMB3 POSIX: how to handle file deletion if the READ-ONLY attribute is set
Subsystems (2)
Hi folks,
as part of the funded work to fill in missing pieces in the SMB3 POSIX spec, I picked up on the old problem of how to handle files with READ-ONLY attribute when deleting the file.
Currently there's no mention of this in the spec.
Iirc the Linux kernel client has fallback code to handle this which is not ideal.
A while ago MS introduced FileDispositionInformationEx which is also not ideal as it
- requires explicit handling in server and client and
- does not allow to build a single round trip client implementation that works in all cases including subtle ones like:
1) File with FILE_ATTRIBUTE_READONLY that allows DELETE and FILE_WRITE_ATTRIBUTES
2) File with FILE_ATTRIBUTE_NORMAL attributes that allows DELETE access but not FILE_WRITE_ATTRIBUTES
You can only delete 1) if you open the file requesting FILE_WRITE_ATTRIBUTES access.
You can only delete 2) if you don't request FILE_WRITE_ATTRIBUTES access.
You can't have your cake and eat it, you can't have 1) and 2) working at the same time when using FileDispositionInformationEx in a single roundtrip.
I was wondering if we could do better then this and came up with the following:
<https://gitlab.com/smb3-posix-extensions/smb3-posix-extensions/-/merge_requests/1>
The gist of this is: on a POSIX handle FILE_ATTRIBUTE_READONLY gets ignored when deleting files given the user has FILE_WRITE_ATTRIBUTES in the filesystem.
I've implemented this for the server in Samba:
<https://gitlab.com/samba-team/samba/-/merge_requests/4440>
Thoughts?
Thanks!
-slow