]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
handle CTDB_CURRENT_NODE in ban commands
authorAndrew Tridgell <tridge@samba.org>
Thu, 7 Jun 2007 06:48:31 +0000 (16:48 +1000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 7 Jun 2007 06:48:31 +0000 (16:48 +1000)
(This used to be ctdb commit fefb53f1d22c5458a1e107f8352818aee87983de)

ctdb/common/ctdb_recoverd.c
ctdb/tools/ctdb_control.c

index d78716986e4694d4858f24d1c5883fa60fba3a59..9ddbad787f637fed6513003ca0e47e615a963829 100644 (file)
@@ -54,6 +54,11 @@ static void ctdb_unban_node(struct ctdb_recoverd *rec, uint32_t vnn)
 {
        struct ctdb_context *ctdb = rec->ctdb;
 
+       if (!ctdb_validate_vnn(ctdb, vnn)) {
+               DEBUG(0,("Bad vnn %u in ctdb_ban_node\n", vnn));
+               return;
+       }
+
        if (rec->banned_nodes[vnn] == NULL) {
                return;
        }
@@ -85,6 +90,11 @@ static void ctdb_ban_node(struct ctdb_recoverd *rec, uint32_t vnn, uint32_t ban_
 {
        struct ctdb_context *ctdb = rec->ctdb;
 
+       if (!ctdb_validate_vnn(ctdb, vnn)) {
+               DEBUG(0,("Bad vnn %u in ctdb_ban_node\n", vnn));
+               return;
+       }
+
        ctdb_ctrl_modflags(ctdb, CONTROL_TIMEOUT(), vnn, NODE_FLAGS_BANNED, 0);
 
        rec->banned_nodes[vnn] = talloc(rec, struct ban_state);
index 04a29e3c0816aa2c618ad45e9783be7da94d5f86..2b6a37dced4b62f26b5af028f05bdbf4ab24790e 100644 (file)
@@ -462,6 +462,10 @@ static int control_ban(struct ctdb_context *ctdb, int argc, const char **argv)
                usage();
        }
 
+       if (options.vnn == CTDB_CURRENT_NODE) {
+               options.vnn = ctdb_ctrl_getvnn(ctdb, TIMELIMIT(), options.vnn);         
+       }
+
        if (options.vnn == CTDB_BROADCAST_ALL) {
                uint32_t *nodes;
                uint32_t num_nodes;
@@ -512,6 +516,10 @@ static int control_unban(struct ctdb_context *ctdb, int argc, const char **argv)
        uint32_t recmaster;
        TDB_DATA data;
 
+       if (options.vnn == CTDB_CURRENT_NODE) {
+               options.vnn = ctdb_ctrl_getvnn(ctdb, TIMELIMIT(), options.vnn);         
+       }
+
        if (options.vnn == CTDB_BROADCAST_ALL) {
                uint32_t *nodes;
                uint32_t num_nodes;