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

[Cluster-devel] [PATCH 1/2] cman: Print an error if cluster name is too long



From: Christine Caulfield <ccaulfie redhat com>

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

Resolvs: rhbz#728230

Signed-off-by: Christine Caulfield <ccaulfie 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 aeedf8b..e435484 100644
--- a/cman/daemon/cman-preconfig.c
+++ b/cman/daemon/cman-preconfig.c
@@ -1274,6 +1274,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");
-- 
1.7.4.4


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