vfs_fruit: resource fork open request with flags=O_CREAT|O_RDONLY
authorRalph Boehme <slow@samba.org>
Tue, 7 Feb 2017 06:44:40 +0000 (07:44 +0100)
committerKarolin Seeger <kseeger@samba.org>
Thu, 20 Apr 2017 10:23:17 +0000 (12:23 +0200)
commitfe3fe4fa906f4a1a61d85af9b0793ce075de983f
tree52d8492cae193c0f61989f037184d448eb44a337
parent981e667e48fe30c179f815da25608157c3518813
vfs_fruit: resource fork open request with flags=O_CREAT|O_RDONLY

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.

If the file doesn't exist, ie there's currently no rsrc stream, we create
it 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.

Running this create requests against macOS SMB server yields an
interesting result: it returns NT_STATUS_OBJECT_NAME_NOT_FOUND even
though create dispotion is open_if. Another instance where the macOS SMB
server just exposes FSA behaviour (ie HFS+) and we have to adapt to be
compatible.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12565

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit a36de8b81aa88c31450e68ec54d6b659b1693878)
source3/modules/vfs_fruit.c