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