From: Ralph Boehme Date: Mon, 11 May 2020 09:35:04 +0000 (+0200) Subject: s3/locking: prime flags in a fresh sharemode data object X-Git-Tag: ldb-2.2.0~551 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bf04ca5658dcf7d7cdf5f718eec0e5e21f9a0d64;p=thirdparty%2Fsamba.git s3/locking: prime flags in a fresh sharemode data object This is needed to prime the logic in share_mode_flags_restrict() for the following scenario: * (First) CREATE on a file with FILE_SHARE_NONE and access_mask=FILE_READ_ATTRIBUTES (a stat-open). * share_mode_flags_restrict() gets called with share_mode_flags_restrict(flags=0, access_mask=0x80, share_mode=0, lease_type=UINT32_MAX) and returns a value where none of the FILE_SHARE_* flags is set. As a result share_mode_data.flags doesn't reflect the share-modes in effect. This doesn't change any current visible behaviour outside of open_mode_check(), but it avoids calling share_mode_forall_entries() in open_mode_check_fn(). BUG: https://bugzilla.samba.org/show_bug.cgi?id=14375 Signed-off-by: Ralph Boehme Reviewed-by: Volker Lendecke Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Tue May 12 19:52:48 UTC 2020 on sn-devel-184 --- diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c index de59b8d2545..ff77f12d1f7 100644 --- a/source3/locking/share_mode_lock.c +++ b/source3/locking/share_mode_lock.c @@ -530,6 +530,9 @@ static struct share_mode_data *fresh_share_mode_lock( goto fail; } d->old_write_time = full_timespec_to_nt_time(old_write_time); + d->flags = SHARE_MODE_SHARE_DELETE | + SHARE_MODE_SHARE_WRITE | + SHARE_MODE_SHARE_READ; d->modified = false; d->fresh = true; return d;