1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

ctdb-daemon: Don't allow attach from recovery if recovery is not active

Neither the recovery daemon nor the recovery helper should attach
databases outside of the recovery process.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2020-02-25 17:32:56 +11:00 committed by Martin Schwenke
parent 052f1bdb9c
commit 147afe77de

View File

@ -1135,6 +1135,13 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb,
return -1;
}
if ((c->flags & CTDB_CTRL_FLAG_ATTACH_RECOVERY) &&
ctdb->recovery_mode != CTDB_RECOVERY_ACTIVE) {
DBG_ERR("Attach from recovery refused because "
"recovery is not active\n");
return -1;
}
if (!(c->flags & CTDB_CTRL_FLAG_ATTACH_RECOVERY) &&
(ctdb->recovery_mode == CTDB_RECOVERY_ACTIVE ||
ctdb->runstate < CTDB_RUNSTATE_STARTUP)) {