Skip to content

Commit

Permalink
vfs_shadow_copy2: Preserve all open flags assuming ROFS
Browse files Browse the repository at this point in the history
Instead of replacing open flags with just O_RDONLY, filter out all those
flags unrelated to a Read Only File System

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14573

Signed-off-by: Anoop C S <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>

Autobuild-User(master): Ralph Böhme <[email protected]>
Autobuild-Date(master): Thu Nov 12 17:23:19 UTC 2020 on sn-devel-184
  • Loading branch information
anoopcs9 authored and slowfranklin committed Nov 12, 2020
1 parent 8036bf9 commit e9e06a1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source3/modules/vfs_shadow_copy2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1351,7 +1351,7 @@ static int shadow_copy2_openat(vfs_handle_struct *handle,
* EINVAL which we carefully map to EROFS. In sum, this
* matches Windows behaviour.
*/
flags = O_RDONLY;
flags &= ~(O_WRONLY | O_RDWR | O_CREAT);
}
return SMB_VFS_NEXT_OPENAT(handle,
dirfsp,
Expand Down Expand Up @@ -1385,7 +1385,7 @@ static int shadow_copy2_openat(vfs_handle_struct *handle,
* pwrite() syscall with EINVAL which we carefully map to EROFS. In sum,
* this matches Windows behaviour.
*/
flags = O_RDONLY;
flags &= ~(O_WRONLY | O_RDWR | O_CREAT);

ret = SMB_VFS_NEXT_OPENAT(handle,
dirfsp,
Expand Down

0 comments on commit e9e06a1

Please sign in to comment.