* [Cluster-devel] [PATCH] cman: fix handling of transport="xxx" in cman/totem preconfig
@ 2011-08-08 9:37 Fabio M. Di Nitto
2011-08-08 10:15 ` Jan Friesse
0 siblings, 1 reply; 2+ messages in thread
From: Fabio M. Di Nitto @ 2011-08-08 9:37 UTC (permalink / raw)
To: cluster-devel.redhat.com
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Cluster-devel] [PATCH] cman: fix handling of transport="xxx" in cman/totem preconfig
2011-08-08 9:37 [Cluster-devel] [PATCH] cman: fix handling of transport="xxx" in cman/totem preconfig Fabio M. Di Nitto
@ 2011-08-08 10:15 ` Jan Friesse
0 siblings, 0 replies; 2+ messages in thread
From: Jan Friesse @ 2011-08-08 10:15 UTC (permalink / raw)
To: cluster-devel.redhat.com
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
Fabio M. Di Nitto napsal(a):
> 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 */
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-08-08 10:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-08 9:37 [Cluster-devel] [PATCH] cman: fix handling of transport="xxx" in cman/totem preconfig Fabio M. Di Nitto
2011-08-08 10:15 ` Jan Friesse
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).