Bug 12565 - vfs_fruit: resource fork open request with flags=O_CREAT|O_RDONLY
Summary: vfs_fruit: resource fork open request with flags=O_CREAT|O_RDONLY
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: Ralph Böhme
QA Contact: Samba QA Contact
Depends on:
Reported: 2017-02-07 06:12 UTC by Ralph Böhme
Modified: 2018-10-10 09:11 UTC (History)
3 users (show)

See Also:

Patch for 4.5 and 4.6 cherry-picked from master (5.80 KB, patch)
2017-04-10 17:42 UTC, Ralph Böhme
jra: review+

Note You need to log in before you can comment on or make changes to this bug.
Description Ralph Böhme 2017-02-07 06:12:09 UTC
When receiving an SMB create request with read-only access mode and open_if disposition, we end of calling the open() function with flags=O_CREAT|O_RDONLY for the ._ AppleDouble file.

The file gets created but then we fail to write the AppleDouble header into the file due to the O_RDONLY open mode, leaving a 0 byte size ._ file.

Patch to follow...
Comment 1 Ralph Böhme 2017-02-07 06:50:19 UTC
Oh, checking against macOS SMB server it returns NT_STATUS_OBJECT_NAME_NOT_FOUND for this combination.
Comment 2 Ralph Böhme 2017-02-08 10:05:49 UTC
(In reply to Ralph Böhme from comment #1)
...for the case that there is no rsrc stream. If there is one, it is just openend.
Comment 3 Stefan Metzmacher 2017-04-03 12:55:51 UTC
Ralph, isn't this already fixed?
Comment 4 Ralph Böhme 2017-04-03 13:44:06 UTC
Hum, I thought so, yes. But briefly checking the code it doesn't look like. Strange...
Comment 5 Ralph Böhme 2017-04-10 17:42:49 UTC
Created attachment 13147 [details]
Patch for 4.5 and 4.6 cherry-picked from master
Comment 6 Jeremy Allison 2017-04-10 20:36:49 UTC
Comment on attachment 13147 [details]
Patch for 4.5 and 4.6 cherry-picked from master

Comment 7 Jeremy Allison 2017-04-10 20:37:14 UTC
Re-assigning to Karolin for inclusion in 4.6.next, 4.5.next.
Comment 8 Karolin Seeger 2017-04-19 09:24:27 UTC
(In reply to Jeremy Allison from comment #7)
Pushed to autobuild-v4-{6,5}-test.
Comment 9 Karolin Seeger 2017-04-21 06:51:36 UTC
(In reply to Karolin Seeger from comment #8)
Pushed to both branches.
Closing out bug report.

Comment 10 Ralph Böhme 2018-10-09 15:59:29 UTC
Looks like Apple's SMB server changed behaviour as I can't reproduce this anymore.

Opening read-only with open_if dispostion now doesn't return NT_STATUS_OBJECT_NAME_NOT_FOUND anymore but succeeds. Tested against 10.3.6, 10.12.3 and 10.10.4. Go figure...
Comment 11 Karolin Seeger 2018-10-10 09:11:19 UTC
Re-assigning to Ralph.