freeradius/freeradius-talloc-dummy-request.patch
Nikolai Kondrashov d2cf93dd4f Fix five issues
2014-10-14 15:33:44 +03:00

49 lines
1.6 KiB
Diff

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