From 79cd7f7c028d1627fe86e740562ec9cab0a817e1 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Sat, 9 May 2020 15:13:54 +0200 Subject: [PATCH] WIP smbd: fix for BUG xxx --- source3/smbd/open.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/source3/smbd/open.c b/source3/smbd/open.c index b6a326531aa..2fbe9a5aaaf 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1786,14 +1786,30 @@ static bool open_mode_check_fn( struct open_mode_check_state *state = private_data; bool disconnected, stale; uint32_t access_mask, share_access, lease_type; + const uint32_t conflicting_access = + FILE_WRITE_DATA| + FILE_APPEND_DATA| + FILE_READ_DATA| + FILE_EXECUTE| + DELETE_ACCESS; disconnected = server_id_is_disconnected(&e->pid); if (disconnected) { return false; } + /* + * Ensure sharemodes of opens with non-conflicting access don't get + * propagated into sharemode-flags. + */ + if (e->access_mask & conflicting_access) { + share_access = e->share_access; + } else { + share_access = FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE; + } + access_mask = state->access_mask | e->access_mask; - share_access = state->share_access & e->share_access; + share_access = state->share_access & share_access; lease_type = state->lease_type | get_lease_type(e, state->fid); if ((access_mask == state->access_mask) && @@ -1824,12 +1840,6 @@ static NTSTATUS open_mode_check(connection_struct *conn, uint16_t new_flags; bool ok, conflict, have_share_entries; - if (is_oplock_stat_open(access_mask)) { - /* Stat open that doesn't trigger oplock breaks or share mode - * checks... ! JRA. */ - return NT_STATUS_OK; - } - /* * Check if the share modes will give us access. */ -- 2.26.2