From: Alan T. DeKok Date: Wed, 30 Jan 2013 14:30:49 +0000 (-0500) Subject: Ensure that replication doesn't affect request->proxy X-Git-Tag: release_2_2_1~189 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9b1b54a78ff2310f3cec7db64e09de1f82a6aeb;p=thirdparty%2Ffreeradius-server.git Ensure that replication doesn't affect request->proxy --- diff --git a/src/modules/rlm_replicate/rlm_replicate.c b/src/modules/rlm_replicate/rlm_replicate.c index c3287416a2f..fae31c05208 100644 --- a/src/modules/rlm_replicate/rlm_replicate.c +++ b/src/modules/rlm_replicate/rlm_replicate.c @@ -26,6 +26,7 @@ RCSID("$Id$") #include #include +#include static void cleanup(RADIUS_PACKET *packet) @@ -49,6 +50,7 @@ static int replicate_packet(void *instance, REQUEST *request) instance = instance; /* -Wunused */ last = request->config_items; + rad_assert(request->proxy == NULL); /* * Send as many packets as necessary to different @@ -74,7 +76,8 @@ static int replicate_packet(void *instance, REQUEST *request) RDEBUG2("ERROR: Cannot replicate unknown packet code %d", request->packet->code); cleanup(packet); - return RLM_MODULE_FAIL; + rcode = RLM_MODULE_FAIL; + break; case PW_AUTHENTICATION_REQUEST: pool = realm->auth_pool; @@ -109,7 +112,10 @@ static int replicate_packet(void *instance, REQUEST *request) if (!packet) { packet = rad_alloc(1); - if (!packet) return RLM_MODULE_FAIL; + if (!packet) { + rcode = RLM_MODULE_FAIL; + break; + } packet->sockfd = -1; packet->code = request->packet->code; packet->id = fr_rand() & 0xff; @@ -118,14 +124,16 @@ static int replicate_packet(void *instance, REQUEST *request) if (packet->sockfd < 0) { RDEBUG("ERROR: Failed opening socket: %s", fr_strerror()); cleanup(packet); - return RLM_MODULE_FAIL; + rcode = RLM_MODULE_FAIL; + break; } packet->vps = paircopy(request->packet->vps); if (!packet->vps) { RDEBUG("ERROR: Out of memory!"); cleanup(packet); - return RLM_MODULE_FAIL; + rcode = RLM_MODULE_FAIL; + break; } /* @@ -171,7 +179,8 @@ static int replicate_packet(void *instance, REQUEST *request) RDEBUG("ERROR: Failed replicating packet: %s", fr_strerror()); cleanup(packet); - return RLM_MODULE_FAIL; + rcode = RLM_MODULE_FAIL; + break; } /* @@ -181,6 +190,8 @@ static int replicate_packet(void *instance, REQUEST *request) } cleanup(packet); + rad_free(&request->proxy); + return rcode; }