Cygwin: fix permission problem when writing DAC info on Samba shares

Cygwin always requests FILE_WRITE_ATTRIBUTES permissions when trying to
change DAC information.  This can lead to permission problems when
trying to chmod/chown files on Samba shares.  Drop requesting
FILE_WRITE_ATTRIBUTES on Samba shares and go with WRITE_DAC/WRITE_OWNER
only.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2021-11-04 21:48:45 +01:00
parent bd4eaebb6f
commit 0390cc8572
2 changed files with 6 additions and 2 deletions

View File

@ -561,10 +561,12 @@ fhandler_base::open (int flags, mode_t mode)
access = READ_CONTROL | FILE_READ_ATTRIBUTES;
break;
case query_write_control:
access = READ_CONTROL | WRITE_OWNER | WRITE_DAC | FILE_WRITE_ATTRIBUTES;
access = READ_CONTROL | WRITE_OWNER | WRITE_DAC
| (pc.fs_is_samba () ? 0 : FILE_WRITE_ATTRIBUTES);
break;
case query_write_dac:
access = READ_CONTROL | WRITE_DAC | FILE_WRITE_ATTRIBUTES;
access = READ_CONTROL | WRITE_DAC
| (pc.fs_is_samba () ? 0 : FILE_WRITE_ATTRIBUTES);
break;
case query_write_attributes:
access = READ_CONTROL | FILE_WRITE_ATTRIBUTES;

View File

@ -6,3 +6,5 @@ Bug Fixes
- Fix a float rounding issue in newlib.
Addresses: https://sourceware.org/pipermail/newlib/2021/018626.html
- Fix a permission problem when writing ACLs on Samba.