1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-26 18:50:30 +03:00

dbwrap: completely check validity of lock order in dbwrap_check_lock_order()

This is currently not strictly necessay, because the
only caller catches the DBWRAP_LOCK_ORDER_NONE case,
and maximum is already checked,  but this seems too dangerous to me.

Use the new DBWRAP_LOCK_ORDER_VALID() macro.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Michael Adam 2014-01-27 17:34:31 +01:00 committed by Stefan Metzmacher
parent 99140170a5
commit c7961ee495

View File

@ -167,7 +167,7 @@ static struct dbwrap_lock_order_state *dbwrap_check_lock_order(
static struct db_context *locked_dbs[DBWRAP_LOCK_ORDER_MAX];
struct dbwrap_lock_order_state *state = NULL;
if (db->lock_order > DBWRAP_LOCK_ORDER_MAX) {
if (!DBWRAP_LOCK_ORDER_VALID(db->lock_order)) {
DEBUG(0,("Invalid lock order %d of %s\n",
(int)db->lock_order, db->name));
smb_panic("invalid lock_order\n");