From: Arran Cudbard-Bell Date: Sun, 2 Dec 2012 12:39:10 +0000 (+0000) Subject: Handle empty lists better X-Git-Tag: release_3_0_0_beta1~1441 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=edecceec53cea67f4e2529834b28e662322845d3;p=thirdparty%2Ffreeradius-server.git Handle empty lists better --- diff --git a/src/modules/rlm_replicate/rlm_replicate.c b/src/modules/rlm_replicate/rlm_replicate.c index 5a28e20b573..7125cbe02a4 100644 --- a/src/modules/rlm_replicate/rlm_replicate.c +++ b/src/modules/rlm_replicate/rlm_replicate.c @@ -148,12 +148,20 @@ static int replicate_packet(void *instance, REQUEST *request, goto done; } - packet->vps = paircopy(*vps); - if (!packet->vps) { - RDEBUG("ERROR: Out of memory!"); - rcode = RLM_MODULE_FAIL; - goto done; + /* + * Don't assume the list actually contains any + * attributes. + */ + if (*vps) { + packet->vps = paircopy(*vps); + if (!packet->vps) { + RDEBUG("ERROR: Out of memory!"); + rcode = RLM_MODULE_FAIL; + goto done; + } } + + /* * For CHAP, create the CHAP-Challenge if @@ -193,7 +201,8 @@ static int replicate_packet(void *instance, REQUEST *request, /* * Encode, sign and then send the packet. */ - RDEBUG("Replicating packet to Realm %s", realm->name); + RDEBUG("Replicating list '%s' to Realm '%s'", + fr_int2str(pair_lists, list, "¿unknown?"),realm->name); if (rad_send(packet, NULL, home->secret) < 0) { RDEBUG("ERROR: Failed replicating packet: %s", fr_strerror());