From: Alan T. DeKok Date: Wed, 25 May 2011 09:43:12 +0000 (+0200) Subject: Make it build && work. X-Git-Tag: release_2_1_11~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c96ebcf1cc676417fbeaf6eccd6583824216dffa;p=thirdparty%2Ffreeradius-server.git Make it build && work. Apparently infinite loops are bad. Who knew? --- diff --git a/src/modules/rlm_replicate/rlm_replicate.c b/src/modules/rlm_replicate/rlm_replicate.c index 1a219cf8593..b2b8150ec87 100644 --- a/src/modules/rlm_replicate/rlm_replicate.c +++ b/src/modules/rlm_replicate/rlm_replicate.c @@ -41,22 +41,25 @@ static void cleanup(RADIUS_PACKET *packet) static int replicate_packet(void *instance, REQUEST *request) { int rcode = RLM_MODULE_NOOP; - VALUE_PAIR *vp; + VALUE_PAIR *vp, *last; home_server *home; REALM *realm; home_pool_t *pool; - RADIUS_PACKET *packet; + RADIUS_PACKET *packet = NULL; instance = instance; /* -Wunused */ + last = request->config_items; /* * Send as many packets as necessary to different * destinations. */ while (1) { - vp = pairfind(request->config_items, PW_REPLICATE_TO_REALM); + vp = pairfind(last, PW_REPLICATE_TO_REALM); if (!vp) break; + last = vp->next; + realm = realm_find2(vp->vp_strvalue); if (!realm) { RDEBUG2("ERROR: Cannot Replicate to unknown realm %s", realm); @@ -119,9 +122,9 @@ static int replicate_packet(void *instance, REQUEST *request) return RLM_MODULE_FAIL; } } else { - int i; + size_t i; - for (i = 0; i < sizeof(packet->vector)) { + for (i = 0; i < sizeof(packet->vector); i++) { packet->vector[i] = fr_rand() & 0xff; } @@ -142,6 +145,7 @@ static int replicate_packet(void *instance, REQUEST *request) /* * Encode, sign and then send the packet. */ + RDEBUG("Replicating packet to Realm %s", realm->name); if (rad_send(packet, NULL, home->secret) < 0) { RDEBUG("ERROR: Failed replicating packet: %s", fr_strerror());