Bug 16030 - Windows Offline Files fails with permission error when directory has the read‑only attribute set
Summary: Windows Offline Files fails with permission error when directory has the read...
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.20.6
Hardware: All Windows 10
: P5 regression (vote)
Target Milestone: ---
Assignee: Samba release manager
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-03-11 19:17 UTC by David Lin
Modified: 2026-06-23 10:50 UTC (History)
4 users (show)

See Also:


Attachments
Patch for v4-24-test (21.88 KB, text/plain)
2026-04-30 10:20 UTC, Stefan Metzmacher
vl: review+
Details
Patch for v4-23-test (22.74 KB, text/plain)
2026-04-30 10:20 UTC, Stefan Metzmacher
vl: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Lin 2026-03-11 19:17:41 UTC
We have encountered an issue affecting Windows Offline Files when a directory on a Samba share has the Windows read‑only attribute set. In Windows, the read‑only attribute on directories is not intended to restrict modification; it functions as a UI hint rather than an access‑control mechanism.
However, in Samba 4.20.6, setting the read‑only attribute on a directory causes Windows Offline Files to fail with a permission error when the client goes offline. While the Windows client remains online, all operations continue to work normally.

Steps to Reproduce

Create a directory on a Samba share.
Set the Windows Read‑only attribute on that directory using attrib or a script.
(Note: Setting the attribute via the Windows Explorer UI does not work.)
Enable Windows Offline Files for the share.
Ensure the directory is fully synced.
Disconnect the client from the network (e.g., disable the network interface).
Attempt to create a file or folder inside the offline‑cached directory.


Observed Result
Windows reports a permission error when attempting to create files or folders offline.
Expected Behavior
Creating files or folders should succeed offline, consistent with Windows server behavior and with Samba versions prior to 4.18.

Additional Technical Details
When preparing to operate offline, Windows uses the SMB2_CREATE_QUERY_MAXIMAL_ACCESS_REQUEST create context to determine and cache the allowed access mask for the directory.

In Samba 4.17, the returned access mask was:
0x001f01ff
In Samba 4.20, the returned access mask is reduced to:
0x000c00e9

The reduced mask appears to cause Windows to treat the directory as lacking sufficient permissions for offline modifications.
We traced the regression to a behavior change introduced in Samba 4.18, likely related to the logic around read‑only directory handling in open.c:
https://gitlab.com/samba-team/samba/-/blob/samba-4.18.0/source3/smbd/open.c?ref_type=tags#L3505
Comment 1 Samba QA Contact 2026-04-29 12:01:03 UTC
This bug was referenced in samba master:

605542e58fb3c436d4a5c0aa5b6b430d135ac7ff
878e7975de17b5c8218cb2c44b44d8a8fac4f073
b6d53b25e2788473e3cec483bc6a4220cc9641c1
671c7bb4dc9c7142b7eeaa673b6cc692b5b67425
03fa9d035d0bd657eaf46abfd8bedf93681a4338
2a1b8321af1755fa424eec8c3931f167a8399127
4ab12a63a4aa4f3625bc3e81817d0169c9b2766e
Comment 2 Stefan Metzmacher 2026-04-30 10:20:29 UTC
Created attachment 18956 [details]
Patch for v4-24-test
Comment 3 Stefan Metzmacher 2026-04-30 10:20:55 UTC
Created attachment 18957 [details]
Patch for v4-23-test
Comment 4 Samba QA Contact 2026-05-12 14:57:53 UTC
This bug was referenced in samba v4-24-test:

bdcbfd011435b472416f374700288d94f4472607
00b563f9a039fefc77fd02912bffcd2fed639bcf
4aa894bb2ad780f4d6918652ab3a7edfeaef3b48
db0479d0bb03eec397d1721e9e6814b999bcbff3
a1650af4e049dc9cea87aac13cd0fd185ba8cd81
52842a7e1907dc9e1823766027ec8d59910416d7
38c1de92b4f4cb6ee03f552b0131c4e53961878b
Comment 5 Samba QA Contact 2026-05-12 15:55:30 UTC
This bug was referenced in samba v4-24-stable (Release samba-4.24.2):

bdcbfd011435b472416f374700288d94f4472607
00b563f9a039fefc77fd02912bffcd2fed639bcf
4aa894bb2ad780f4d6918652ab3a7edfeaef3b48
db0479d0bb03eec397d1721e9e6814b999bcbff3
a1650af4e049dc9cea87aac13cd0fd185ba8cd81
52842a7e1907dc9e1823766027ec8d59910416d7
38c1de92b4f4cb6ee03f552b0131c4e53961878b
Comment 6 Samba QA Contact 2026-05-28 01:38:28 UTC
This bug was referenced in samba v4-23-test:

c6d1b34606821dbcb3f6cdf60c4372f23ef3f3a9
9b85ed994bf1152b0733b99a2c5fcee820115199
7efa3b5e200505f0122309c72c3dc4918fb66501
7458731ab81e03dd7eff36deec95bdfa1a536f34
e7a8c0e499e71d474d74f0101573b6180604f255
3d74e1010f01dc8c335c2829c07e3ae1799fba90
3c4c0cff30555c23dd05d65e6e9a8b15cd463856
Comment 7 Samba QA Contact 2026-06-23 10:50:26 UTC
This bug was referenced in samba v4-23-stable (Release samba-4.23.9):

c6d1b34606821dbcb3f6cdf60c4372f23ef3f3a9
9b85ed994bf1152b0733b99a2c5fcee820115199
7efa3b5e200505f0122309c72c3dc4918fb66501
7458731ab81e03dd7eff36deec95bdfa1a536f34
e7a8c0e499e71d474d74f0101573b6180604f255
3d74e1010f01dc8c335c2829c07e3ae1799fba90
3c4c0cff30555c23dd05d65e6e9a8b15cd463856