aboutsummaryrefslogtreecommitdiffstats
path: root/main/freeradius/fix-request_running-segfault.patch
blob: e6973b19a6fb95f96ddcecd88484898d59675c00 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
From 30ffd2174ec0acd1c5b4b4988d522c24d80a1049 Mon Sep 17 00:00:00 2001
From: "Alan T. DeKok" <aland@freeradius.org>
Date: Wed, 20 Nov 2019 08:30:42 -0500
Subject: [PATCH] home_server may be NULL if proxying fails

---
 src/main/process.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/main/process.c b/src/main/process.c
index 78c6d8a9e5..c8b3af24e2 100644
--- a/src/main/process.c
+++ b/src/main/process.c
@@ -1642,7 +1642,8 @@ static void request_running(REQUEST *request, int action)
 			 *	handler.
 			 */
 			if (request_proxy(request) < 0) {
-				if (request->home_server && request->home_server->server) goto req_finished;
+				if (!request->home_server ||
+				    (request->home_server && request->home_server->server)) goto req_finished;
 
 				(void) setup_post_proxy_fail(request);
 				process_proxy_reply(request, NULL);
From e2de6fab148e800380f1929fe4ea88a38de42053 Mon Sep 17 00:00:00 2001
From: "Alan T. DeKok" <aland@freeradius.org>
Date: Wed, 20 Nov 2019 13:59:54 -0500
Subject: [PATCH] a better fix for commit 30ffd21

Which still runs post-proxy-type fail if all of the home servers
are dead
---
 src/main/process.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/main/process.c b/src/main/process.c
index c8b3af24e2..1a48517d43 100644
--- a/src/main/process.c
+++ b/src/main/process.c
@@ -1642,8 +1642,7 @@ static void request_running(REQUEST *request, int action)
 			 *	handler.
 			 */
 			if (request_proxy(request) < 0) {
-				if (!request->home_server ||
-				    (request->home_server && request->home_server->server)) goto req_finished;
+				if (request->home_server && request->home_server->server) goto req_finished;
 
 				(void) setup_post_proxy_fail(request);
 				process_proxy_reply(request, NULL);
@@ -2475,13 +2474,12 @@ static int process_proxy_reply(REQUEST *request, RADIUS_PACKET *reply)
 	}
 
 	old_server = request->server;
-	rad_assert(request->home_server != NULL);
 
 	/*
 	 *	If the home server is virtual, just run pre_proxy from
 	 *	that section.
 	 */
-	if (request->home_server->server) {
+	if (request->home_server && request->home_server->server) {
 		request->server = request->home_server->server;
 
 	} else {
@@ -3182,13 +3180,12 @@ static int request_will_proxy(REQUEST *request)
 	}
 
 	old_server = request->server;
-	rad_assert(request->home_server != NULL);
 
 	/*
 	 *	If the home server is virtual, just run pre_proxy from
 	 *	that section.
 	 */
-	if (request->home_server->server) {
+	if (request->home_server && request->home_server->server) {
 		request->server = request->home_server->server;
 
 	} else {