fe9ead
From 03c5915208234255484ece4c233c9e252776e3a3 Mon Sep 17 00:00:00 2001
fe9ead
From: Nikolai Kondrashov <nikolai.kondrashov@redhat.com>
fe9ead
Date: Mon, 29 Sep 2014 17:40:10 +0300
fe9ead
Subject: [PATCH 1/1] process: Talloc home_trigger dummy request
fe9ead
fe9ead
Allocate the dummy request in home_trigger with talloc, instead of
fe9ead
allocating it on the stack, as the rest of the code expects it to be a
fe9ead
valid talloc context.
fe9ead
fe9ead
This fixes a talloc_abort resulting from xlat_tokenize_request invoking
fe9ead
talloc_typed_strdup with the dummy request as the talloc context.
fe9ead
---
fe9ead
 src/main/process.c | 17 +++++++++--------
fe9ead
 1 file changed, 9 insertions(+), 8 deletions(-)
fe9ead
fe9ead
diff --git a/src/main/process.c b/src/main/process.c
fe9ead
index 76ce4ea..7e1a51e 100644
fe9ead
--- a/src/main/process.c
fe9ead
+++ b/src/main/process.c
fe9ead
@@ -3212,16 +3212,17 @@ static void ping_home_server(void *ctx)
fe9ead
 
fe9ead
 static void home_trigger(home_server_t *home, char const *trigger)
fe9ead
 {
fe9ead
-	REQUEST my_request;
fe9ead
-	RADIUS_PACKET my_packet;
fe9ead
+	REQUEST *my_request;
fe9ead
+	RADIUS_PACKET *my_packet;
fe9ead
 
fe9ead
-	memset(&my_request, 0, sizeof(my_request));
fe9ead
-	memset(&my_packet, 0, sizeof(my_packet));
fe9ead
-	my_request.proxy = &my_packet;
fe9ead
-	my_packet.dst_ipaddr = home->ipaddr;
fe9ead
-	my_packet.src_ipaddr = home->src_ipaddr;
fe9ead
+	my_request = talloc_zero(NULL, REQUEST);
fe9ead
+	my_packet = talloc_zero(my_request, RADIUS_PACKET);
fe9ead
+	my_request->proxy = my_packet;
fe9ead
+	my_packet->dst_ipaddr = home->ipaddr;
fe9ead
+	my_packet->src_ipaddr = home->src_ipaddr;
fe9ead
 
fe9ead
-	exec_trigger(&my_request, home->cs, trigger, false);
fe9ead
+	exec_trigger(my_request, home->cs, trigger, false);
fe9ead
+	talloc_free(my_request);
fe9ead
 }
fe9ead
 
fe9ead
 static void mark_home_server_zombie(home_server_t *home, struct timeval *now, struct timeval *response_window)
fe9ead
-- 
fe9ead
2.1.0
fe9ead