From: Gregor Beck Date: Thu, 21 Jun 2012 08:27:45 +0000 (+0200) Subject: ltdb_server: let ctdbd refuse attach with CLEAR_IF_FIRST for persistent dbs X-Git-Url: http://git.samba.org/?p=obnox%2Fctdb.git;a=commitdiff_plain;h=c256f5d463c86e0cf61840f97fea2d6d47bfa40b ltdb_server: let ctdbd refuse attach with CLEAR_IF_FIRST for persistent dbs --- diff --git a/server/ctdb_ltdb_server.c b/server/ctdb_ltdb_server.c index 0426d96b..edb077de 100644 --- a/server/ctdb_ltdb_server.c +++ b/server/ctdb_ltdb_server.c @@ -1061,6 +1061,14 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata, struct ctdb_db_context *db; struct ctdb_node *node = ctdb->nodes[ctdb->pnn]; struct ctdb_client *client = NULL; + bool clear_if_first = (tdb_flags & TDB_CLEAR_IF_FIRST); + + if (persistent == clear_if_first) { + DEBUG(DEBUG_ERR, ("ERROR: DB Attach to %s: %s\n", db_name, persistent + ? "CLEAR_IF_FIRST is not allowed for persistent databases" + : "non-persistent databases need CLEAR_IF_FIRST")); + return -1; + } if (ctdb->tunable.allow_client_db_attach == 0) { DEBUG(DEBUG_ERR, ("DB Attach to database %s denied by tunable "