From: Martin Schwenke Date: Tue, 25 Feb 2020 06:32:56 +0000 (+1100) Subject: ctdb-daemon: Don't allow attach from recovery if recovery is not active X-Git-Tag: ldb-2.2.0~1256 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=147afe77de372ddb9c180228d6fe1b04cca4610f;p=thirdparty%2Fsamba.git 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 Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/server/ctdb_ltdb_server.c b/ctdb/server/ctdb_ltdb_server.c index e050b7304fe..ce3569fe7b1 100644 --- a/ctdb/server/ctdb_ltdb_server.c +++ b/ctdb/server/ctdb_ltdb_server.c @@ -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)) {