From: Volker Lendecke Date: Mon, 27 Apr 2020 13:59:09 +0000 (+0200) Subject: smbd: Make sure share_mode_entry_do() maintains sorting order X-Git-Tag: ldb-2.2.0~738 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d3399906fe56cb0bd5245bfefb94391bbd0d32c;p=thirdparty%2Fsamba.git smbd: Make sure share_mode_entry_do() maintains sorting order Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c index e66c375a142..183a1e55234 100644 --- a/source3/locking/share_mode_lock.c +++ b/source3/locking/share_mode_lock.c @@ -1962,7 +1962,17 @@ static void share_mode_entry_do_fn( } if (!e.stale) { - bool ok = share_mode_entry_put(&e, &buf); + bool ok; + + if (state->num_share_modes != 1) { + /* + * Make sure the sorting order stays intact + */ + SMB_ASSERT(server_id_equal(&e.pid, &state->pid)); + SMB_ASSERT(e.share_file_id == state->share_file_id); + } + + ok = share_mode_entry_put(&e, &buf); if (!ok) { DBG_DEBUG("share_mode_entry_put failed\n"); state->status = NT_STATUS_INTERNAL_ERROR;