Bug 15378 - vfs_fruit might cause a failing open for delete
Summary: vfs_fruit might cause a failing open for delete
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Jule Anger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-25 19:12 UTC by Ralph Böhme
Modified: 2024-03-15 13:54 UTC (History)
2 users (show)

See Also:


Attachments
Patch for 4.17 and 4.18 cherry-picked from master (63.93 KB, patch)
2023-05-26 13:51 UTC, Ralph Böhme
jra: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ralph Böhme 2023-05-25 19:12:22 UTC
ad_convert_xattr() doesn't pass FILE_SHARE_DELETE to SMB_VFS_CREATE_FILE() and this might trigger a subtle NT_STATUS_SHARING_VIOLATION error.

Not specifying FILE_SHARE_DELETE wasn't done intentionally. Not setting the flag triggers the following problem:

* client sends a CREATE with delete access

* this triggers a call to open_streams_for_delete() where we check for conflicting opens on any of the streams of the file or directory

* if the file (or directory) has a stream like ":com.apple.quarantine" the stream is opened with DELETE_ACCESS and kept open when the next step might:

* if the file (or directory) has a Mac specific :AFP_AfpInfo stream, the ad_convert() routine in fruit_create_file() is triggered

* ad_convert() checks if the file (or ...) has a sidecar ._ AppleDouble file, if it has:
    
* in ad_convert_xattr() we unpack any set of xattrs encoded in the AppleDouble file and recreate them as streams with the VFS. Now, if any of these xattrs happens to be converted to a stream that we still have open in open_streams_for_delete() (see above) we get a NT_STATUS_SHARING_VIOLATION
    
This error gets passed up the stack back to open_streams_for_delete() so the client CREATE request fails and the client is unhappy.

Have patch, need bugnumber...
Comment 1 Samba QA Contact 2023-05-26 00:53:03 UTC
This bug was referenced in samba master:

59eadfe21aca6d563f86ea656517216036421bca
9b91a8bad2ff8da9eb56f1f9d640bcea294a5a0a
06f0c070a0b18313f48362aa326e3e7e6a096492
55bd10456486628cad2bd085618e873598401c3b
3bf97f19c36d26b4178f7cb6202bbdd44de0c1aa
Comment 2 Ralph Böhme 2023-05-26 13:51:02 UTC
Created attachment 17898 [details]
Patch for 4.17 and 4.18 cherry-picked from master
Comment 3 Jeremy Allison 2023-05-30 17:53:02 UTC
Re-assigning to Jule for inclusion in 4.18.next, 4.17.next.
Comment 4 Jule Anger 2023-05-31 07:47:17 UTC
Pushed to autobuild-v4-{18,17}-test.
Comment 5 Samba QA Contact 2023-05-31 08:49:04 UTC
This bug was referenced in samba v4-17-test:

f544dc9cc069457bd1e911e692d28ad1d4e72a03
ed1979c76c6e75f168049fc9669e6e5250264af3
b0e8932b1cf94f1f43ac6eca29250a63bea66708
4e0850b7afc7ac383ddd6929e7b9d3836135564d
a2567c172945a2b3fab6a7741d72d55503ba3ab6
Comment 6 Samba QA Contact 2023-05-31 10:48:11 UTC
This bug was referenced in samba v4-18-test:

976b4955570d34b8b013a7fd17f3551fbf105f83
051cd8f5915615bed9ff8756661afffb794e42b4
fe988c713798732b996de99684c73199ec68b70f
0db5f559d0ef883c975177a705e82ae4d0951c72
5c5ab78d93def900a91954e30fdb25aa1d5a3cdb
Comment 7 Samba QA Contact 2023-05-31 16:11:33 UTC
This bug was referenced in samba v4-18-stable (Release samba-4.18.3):

976b4955570d34b8b013a7fd17f3551fbf105f83
051cd8f5915615bed9ff8756661afffb794e42b4
fe988c713798732b996de99684c73199ec68b70f
0db5f559d0ef883c975177a705e82ae4d0951c72
5c5ab78d93def900a91954e30fdb25aa1d5a3cdb
Comment 8 Jule Anger 2023-05-31 16:12:07 UTC
Closing out bug report.

Thanks!
Comment 9 Samba QA Contact 2023-07-06 14:00:16 UTC
This bug was referenced in samba v4-17-stable (Release samba-4.17.9):

f544dc9cc069457bd1e911e692d28ad1d4e72a03
ed1979c76c6e75f168049fc9669e6e5250264af3
b0e8932b1cf94f1f43ac6eca29250a63bea66708
4e0850b7afc7ac383ddd6929e7b9d3836135564d
a2567c172945a2b3fab6a7741d72d55503ba3ab6