[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Linux-cluster] [PATCH] Fix fence_agent string not correctly sent over the cluster.



Hi all,

on the openais based cman-2.0.35-2.el5 I noticed that the output of
"cman_tool nodes -f" provided a not correctly terminated fence agent
name:

[root nodo01 ~]# cman_tool nodes -f
Node  Sts   Inc   Joined               Name
   1   M      4   2007-01-05 17:39:27  nodo01
   2   X      0                        nodo02
       Last fenced:   2007-01-05 17:39:41 by fence-node02!�
                                                         ^^

I think the problem is in the function do_cmd_update_fence_info in
cman/daemon/commands.c that calculate the bytes needed by the message to
send without counting the \0 terminating the fence_agent string.

I found also another similar problem in another point of the file and I
changed also it, but without testing.

I made a little patch and I hope it's correct.

Thanks!

Bye!
-- 
Simone Gotti

 
 
 --
 Email.it, the professional e-mail, gratis per te: http://www.email.it/f
 
 Sponsor:
 Acquista i tuoi gioielli in tutta sicurezza ed a prezzi veramente imbattibili. Sfoglia il nostro catalogo on-line!
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=5634&d=5-1
diff -r -u -p cman-2.0.35.orig/cman/daemon/commands.c cman-2.0.35/cman/daemon/commands.c
--- cman-2.0.35.orig/cman/daemon/commands.c	2006-11-06 11:06:14.000000000 +0100
+++ cman-2.0.35/cman/daemon/commands.c	2007-01-05 18:12:33.000000000 +0100
@@ -1088,7 +1088,7 @@ static int do_cmd_update_fence_info(char
 {
 	struct cl_fence_info *f = (struct cl_fence_info *)cmdbuf;
 	struct cluster_node *node;
-	char msg[sizeof(struct cl_fencemsg)+strlen(f->fence_agent)];
+	char msg[sizeof(struct cl_fencemsg)+strlen(f->fence_agent)+1];
 	struct cl_fencemsg *fence_msg = (struct cl_fencemsg *)msg;
 
 	node = find_node_by_nodeid(f->nodeid);
@@ -1749,7 +1751,7 @@ static void do_process_transition(int no
 	if (node->fence_time && !msg->fence_time &&
 	    node->fence_agent && !msg->fence_agent[0])
 	{
-		char msg[sizeof(struct cl_fencemsg)+strlen(node->fence_agent)];
+		char msg[sizeof(struct cl_fencemsg)+strlen(node->fence_agent)+1];
 		struct cl_fencemsg *fence_msg = (struct cl_fencemsg *)msg;
 
 		fence_msg->cmd = CLUSTER_MSG_FENCESTATUS;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]