summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2020-02-25 17:32:56 +1100
committerMartin Schwenke <martins@samba.org>2020-03-23 23:45:38 +0000
commit147afe77de372ddb9c180228d6fe1b04cca4610f (patch)
tree91124a3fa0ca1674ce5b99d941f234f93e9987eb /ctdb
parent052f1bdb9cf78f53f584edd32f81ae8e01e8e86e (diff)
downloadsamba-147afe77de372ddb9c180228d6fe1b04cca4610f.tar.gz
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>
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/server/ctdb_ltdb_server.c7
1 files changed, 7 insertions, 0 deletions
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)) {