cluster: RHEL6 - cman: fix handling of transport="xxx" in cman/totem preconfig

Fabio M. Di Nitto fabbione at fedoraproject.org
Mon Aug 8 10:24:53 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=234c0749b15ca95277e6ac4ebf9e68234e9b161f
Commit:        234c0749b15ca95277e6ac4ebf9e68234e9b161f
Parent:        31c734fe4fe5d95fac8fc7a5519c175b748ab8ec
Author:        Fabio M. Di Nitto <fdinitto at redhat.com>
AuthorDate:    Mon Aug 8 11:33:02 2011 +0200
Committer:     Fabio M. Di Nitto <fdinitto at redhat.com>
CommitterDate: Mon Aug 8 12:24:19 2011 +0200

cman: fix handling of transport="xxx" in cman/totem preconfig

and address a memory corruption when broadcast="" is set.

Resolves: rhbz#695795

Reviewed-by: Jan Friesse <jfriesse at redhat.com>
Signed-off-by: Fabio M. Di Nitto <fdinitto at redhat.com>
---
 cman/daemon/cman-preconfig.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c
index d91dce2..c85331b 100644
--- a/cman/daemon/cman-preconfig.c
+++ b/cman/daemon/cman-preconfig.c
@@ -296,6 +296,7 @@ static int add_ifaddr(struct objdb_iface_ver0 *objdb, char *mcast, char *ifaddr,
 	hdb_handle_t interface_object_handle;
 	struct sockaddr_storage if_addr, localhost, mcast_addr;
 	char tmp[132];
+	char *transportstr;
 	int ret = 0;
 	const char *tx_mech_to_str[] = {
 		[TX_MECH_UDP] = "udp",
@@ -322,11 +323,17 @@ static int add_ifaddr(struct objdb_iface_ver0 *objdb, char *mcast, char *ifaddr,
 	if (objdb->object_find_next(find_handle, &totem_object_handle)) {
 		objdb->object_create(OBJECT_PARENT_HANDLE, &totem_object_handle,
 				     "totem", strlen("totem"));
-		objdb->object_key_create_typed(totem_object_handle, "transport",
-			tx_mech_to_str[transport], strlen(tx_mech_to_str[transport]) + 1, OBJDB_VALUETYPE_STRING);
         }
 	objdb->object_find_destroy(find_handle);
 
+	if (objdb_get_string(objdb, totem_object_handle, "transport", &transportstr)) {
+		objdb->object_key_create_typed(totem_object_handle, "transport",
+			tx_mech_to_str[transport], strlen(tx_mech_to_str[transport]) + 1, OBJDB_VALUETYPE_STRING);
+	} else {
+		sprintf(error_reason, "Transport should not be specified within <totem .../>, use <cman transport=\"...\" /> instead");
+		return -1;
+	}
+
 	if (objdb->object_create(totem_object_handle, &interface_object_handle,
 				 "interface", strlen("interface")) == 0) {
 		struct sockaddr_in *in = (struct sockaddr_in *)&if_addr;
@@ -724,7 +731,6 @@ static int get_nodename(struct objdb_iface_ver0 *objdb)
 				return -1;
 			transport = TX_MECH_UDPB;
 		}
-		free(str);
 	}
 
 	/* Check for transport */


More information about the cluster-commits mailing list