cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Fabio M. Di Nitto <fdinitto@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] cman: fix handling of transport="xxx" in cman/totem preconfig
Date: Mon,  8 Aug 2011 11:37:45 +0200	[thread overview]
Message-ID: <1312796265-4279-1-git-send-email-fdinitto@redhat.com> (raw)

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

Resolves: rhbz#695795

Signed-off-by: Fabio M. Di Nitto <fdinitto@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 070761e..0f5f937 100644
--- a/cman/daemon/cman-preconfig.c
+++ b/cman/daemon/cman-preconfig.c
@@ -283,6 +283,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",
@@ -309,11 +310,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;
@@ -709,7 +716,6 @@ static int get_nodename(struct objdb_iface_ver0 *objdb)
 				return -1;
 			transport = TX_MECH_UDPB;
 		}
-		free(str);
 	}
 
 	/* Check for transport */
-- 
1.7.4.4



             reply	other threads:[~2011-08-08  9:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-08  9:37 Fabio M. Di Nitto [this message]
2011-08-08 10:15 ` [Cluster-devel] [PATCH] cman: fix handling of transport="xxx" in cman/totem preconfig Jan Friesse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1312796265-4279-1-git-send-email-fdinitto@redhat.com \
    --to=fdinitto@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).