Bug 12300 - samba allows deleting readonly file regardless of "delete readonly=no"
samba allows deleting readonly file regardless of "delete readonly=no"
Status: NEW
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services
unspecified
All All
: P5 major
: ---
Assigned To: Samba QA Contact
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-09-30 05:42 UTC by Petr Klikorka
Modified: 2017-03-27 10:26 UTC (History)
2 users (show)

See Also:


Attachments
patch (465 bytes, patch)
2016-09-30 05:42 UTC, Petr Klikorka
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Klikorka 2016-09-30 05:42:47 UTC
Created attachment 12517 [details]
patch

It is possible to delete readonly files on samba share regardless of "delete readonly=no" setting, when a windows client uses this API call:

CreateFile(file_path, DELETE, FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_DELETE_ON_CLOSE, NULL);

For instance, the windows 10 file explorer uses this method.

The attached patch seems to solve this bug.
Comment 1 amitkuma 2017-03-27 10:26:13 UTC
Not clear what this bug about.
If delete readonly parameter tells, whether Windows clients can delete files present in samba shares, then this patch does not fixes the Issue.

I was not able to delete files present in samba share with option set to no/yes even. It gives this error
smbd_smb2_request_error_ex: smbd_smb2_request_error_ex: idx[1] status[NT_STATUS_ACCESS_DENIED] || at ../source3/smbd/smb2_create.c:293

[global]
 delete readonly = no

Even manual pages of smb.conf explains:
This parameter allows readonly files to be deleted. This is not normal DOS semantics, but is allowed by UNIX.