Rev 491: handle CTDB_CURRENT_NODE in ban commands in	http://samba.org/~tridge/ctdb ------------------------------------------------------------
revno: 491
revision-id: tridge@samba.org-20070607064831-cs6ed30jggx07qp9
parent: tridge@samba.org-20070607063433-1twaia604wl2j5hj
committer: Andrew Tridgell 
branch nick: tridge
timestamp: Thu 2007-06-07 16:48:31 +1000
message:
  handle CTDB_CURRENT_NODE in ban commands
modified:
  common/ctdb_recoverd.c         recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1
  tools/ctdb_control.c           ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1
=== modified file 'common/ctdb_recoverd.c'
--- a/common/ctdb_recoverd.c	2007-06-07 06:34:33 +0000
+++ b/common/ctdb_recoverd.c	2007-06-07 06:48:31 +0000
@@ -54,6 +54,11 @@
 {
 	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 @@
 {
 	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);

=== modified file 'tools/ctdb_control.c'
--- a/tools/ctdb_control.c	2007-06-07 06:34:33 +0000
+++ b/tools/ctdb_control.c	2007-06-07 06:48:31 +0000
@@ -462,6 +462,10 @@
 		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 @@
 	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;

