From: Arran Cudbard-Bell Date: Thu, 2 Dec 2021 15:29:02 +0000 (-0600) Subject: Provide more information about what expired X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a765eb87285df0760be32715c57553d7a93c503;p=thirdparty%2Ffreeradius-server.git Provide more information about what expired --- diff --git a/src/modules/rlm_cache/rlm_cache.c b/src/modules/rlm_cache/rlm_cache.c index e4a9dd70569..25a492bca02 100644 --- a/src/modules/rlm_cache/rlm_cache.c +++ b/src/modules/rlm_cache/rlm_cache.c @@ -235,17 +235,24 @@ static unlang_action_t cache_find(rlm_rcode_t *p_result, rlm_cache_entry_t **out * Yes, but it expired, OR the "forget all" epoch has * passed. Delete it, and pretend it doesn't exist. */ - if (fr_unix_time_lt(c->expires, fr_time_to_unix_time(request->packet->timestamp)) || - fr_unix_time_lt(c->created, fr_unix_time_from_sec(inst->config.epoch))) { - RDEBUG2("Found entry for \"%pV\", but it expired %pV ago. Removing it", + if (fr_unix_time_lt(c->expires, fr_time_to_unix_time(request->packet->timestamp))) { + RDEBUG2("Found entry for \"%pV\", but it expired %pV ago at %pV (packet received %pV). Removing it", fr_box_strvalue_len((char const *)key, key_len), - fr_box_time_delta(fr_unix_time_sub(fr_time_to_unix_time(request->packet->timestamp), c->expires))); + fr_box_time_delta(fr_unix_time_sub(fr_time_to_unix_time(request->packet->timestamp), c->expires)), + fr_box_date(c->expires), + fr_box_time(request->packet->timestamp)); + expired: inst->driver->expire(&inst->config, inst->driver_inst->dl_inst->data, request, handle, c->key, c->key_len); cache_free(inst, &c); RETURN_MODULE_NOTFOUND; /* Couldn't find a non-expired entry */ } + if (fr_unix_time_lt(c->created, fr_unix_time_from_sec(inst->config.epoch))) { + RDEBUG2("Found entry for \"%pV\", but it was created before the current epoch. Removing it", + fr_box_strvalue_len((char const *)key, key_len)); + goto expired; + } RDEBUG2("Found entry for \"%pV\"", fr_box_strvalue_len((char const *)key, key_len)); c->hits++;