cluster: RHEL6 - cman: Print an error if cluster name is too long

Fabio M. Di Nitto fabbione at fedoraproject.org
Fri Aug 5 09:24:34 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=79aafcef1dafff42afcc085d55188f495ee3cc54
Commit:        79aafcef1dafff42afcc085d55188f495ee3cc54
Parent:        1f345b45a5eeaedfcf5c48ac328c32d32d30ac26
Author:        Christine Caulfield <ccaulfie at redhat.com>
AuthorDate:    Thu Aug 4 15:21:18 2011 +0100
Committer:     Fabio M. Di Nitto <fdinitto at redhat.com>
CommitterDate: Fri Aug 5 11:01:14 2011 +0200

cman: Print an error if cluster name is too long

Print an error and exit cman-preconfig if the cluster name
exceeeds 15 characters.

Resolvs: rhbz#728230

Signed-off-by: Christine Caulfield <ccaulfie at redhat.com>
Signed-off-by: Fabio M. Di Nitto <fdinitto at redhat.com>
---
 cman/daemon/cman-preconfig.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c
index 4eb6250..0abc4cd 100644
--- a/cman/daemon/cman-preconfig.c
+++ b/cman/daemon/cman-preconfig.c
@@ -1290,6 +1290,10 @@ static int get_cman_globals(struct objdb_iface_ver0 *objdb)
 	char *use_hash;
 
 	objdb_get_string(objdb, cluster_parent_handle, "name", &cluster_name);
+	if (!cluster_name || strlen(cluster_name) > 15) {
+		    sprintf(error_reason, "%s\n", "Invalid cluster name. It must be 15 characters or fewer\n");
+		return -1;
+	}
 
 	if (!cluster_name) {
 		sprintf(error_reason, "Unable to determine cluster name.\n");


More information about the cluster-commits mailing list