From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30730 invoked by alias); 3 Sep 2008 11:00:40 -0000 Received: (qmail 30722 invoked by alias); 3 Sep 2008 11:00:40 -0000 X-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,KAM_MX,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on bastion.fedora.phx.redhat.com X-Spam-Level: Subject: master - cman: cope better with malformed config files To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: f308bb5e0a3f7dde8340046a92acee8e72c0017c X-Git-Newrev: 3941e5e4ce38ac3ac49d7dcf4e838dd30b063c62 From: Christine Caulfield Message-Id: <20080903105932.24F7FC07B7@lists.fedorahosted.org> Date: Wed, 03 Sep 2008 12:32:00 -0000 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2008-q3/txt/msg00368.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=3941e5e4ce38ac3ac49d7dcf4e838dd30b063c62 Commit: 3941e5e4ce38ac3ac49d7dcf4e838dd30b063c62 Parent: f308bb5e0a3f7dde8340046a92acee8e72c0017c Author: Christine Caulfield AuthorDate: Wed Sep 3 11:56:52 2008 +0100 Committer: Christine Caulfield CommitterDate: Wed Sep 3 11:56:52 2008 +0100 cman: cope better with malformed config files A config file with would fool cman into not finding the nodename, even though it exists. This fixes that. Signed-off-by: Christine Caulfield --- cman/daemon/cman-preconfig.c | 8 ++++++-- cman/daemon/nodelist.h | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c index 6715b3f..4926591 100644 --- a/cman/daemon/cman-preconfig.c +++ b/cman/daemon/cman-preconfig.c @@ -360,7 +360,8 @@ static int verify_nodename(struct objdb_iface_ver0 *objdb, char *nodename) if (objdb_get_string(objdb, nodes_handle, "name", &str)) { sprintf(error_reason, "Cannot get node name"); - break; + nodes_handle = nodeslist_next(objdb, find_handle); + continue; } strcpy(nodename3, str); @@ -494,7 +495,7 @@ static int get_env_overrides() static int get_nodename(struct objdb_iface_ver0 *objdb) { - char *nodeid_str; + char *nodeid_str = NULL; unsigned int object_handle; unsigned int find_handle; unsigned int node_object_handle; @@ -552,6 +553,9 @@ static int get_nodename(struct objdb_iface_ver0 *objdb) write_cman_pipe("This node has no nodeid in cluster.conf"); return -1; } + sprintf(error_reason, "Failed to find node name in cluster.conf"); + write_cman_pipe("Failed to find node name in cluster.conf"); + return -1; } objdb->object_find_create(cluster_parent_handle, "cman", strlen("cman"), &find_handle); diff --git a/cman/daemon/nodelist.h b/cman/daemon/nodelist.h index faf63c1..02dfe17 100644 --- a/cman/daemon/nodelist.h +++ b/cman/daemon/nodelist.h @@ -79,7 +79,8 @@ static inline unsigned int nodelist_byname(OBJDB_API *corosync, nodes_handle = nodeslist_init(corosync, cluster_parent_handle, &find_handle); while (nodes_handle) { if (objdb_get_string(corosync, nodes_handle, "name", &nodename)) { - break; + nodes_handle = nodeslist_next(corosync, find_handle); + continue; } if (strcmp(nodename, name) == 0) return nodes_handle;