[Samba] Does Samba 4.3.11 support for opening file with “APPEND” mode?

Dong Wei ddweidong at gmail.com
Wed Dec 6 09:30:58 UTC 2017


hi,

I set a file's inode.i_flags to "S_APPEND" in linux kernel, so the
file can only be opened with 'append' mode. In linux system it works
fine as expected. Like, echo "test" > append.txt, permission deny.
echo "test" >> append.txt, OK.

I share the directory to windows with samba server running on Ubuntu
14.4 and the directory is mounted as disk z in Window 7. Do the echo
test in Git Bash, and all I get are "permission deny". But the ">>"
operation should not fail.

I try to access the file with Win32API CreateFile in append mode,
unfortunately I get code error 5(stands for "Access is Denied"). The
API CreateFile is called as CreateFile("append.txt", FILE_APPEND_DATA,
FILE_SHARED_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE |
FILE_FLAG_POSIX_SEMANTICS, NULL).

When I look into Samba source code, in function smbd_smb2_create_send,
the FILE_FLAG_POSIX_SEMANTICS is removed from in_file_attributes. In
function calculate_open_access_flags, FILE_APPEND_DATA is just treated
as FILE_WRITE_DATA.

So I wonder, samba server maybe not support for opening file in append
mode. Is that right?


Many thanks for your guidance in advance.

--

Thanks & Regards,

wei dong



More information about the samba mailing list