From: Alan T. DeKok Date: Wed, 8 Sep 2021 12:36:34 +0000 (-0400) Subject: use packet timestamp as "now" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4404b9c04a272a411d4da102907133ca3579ee9;p=thirdparty%2Ffreeradius-server.git use packet timestamp as "now" instead of whenever we got around to processing the request. this is more likely to be what the user intended --- diff --git a/src/modules/rlm_totp/rlm_totp.c b/src/modules/rlm_totp/rlm_totp.c index 814154ceb04..acad3a87688 100644 --- a/src/modules/rlm_totp/rlm_totp.c +++ b/src/modules/rlm_totp/rlm_totp.c @@ -271,7 +271,7 @@ static unlang_action_t CC_HINT(nonnull) mod_authenticate(rlm_rcode_t *p_result, keylen = len; } - if (totp_cmp(time(NULL), key, keylen, password->vp_strvalue) != 0) RETURN_MODULE_FAIL; + if (totp_cmp(fr_time_to_sec(request->packet->timestamp), key, keylen, password->vp_strvalue) != 0) RETURN_MODULE_FAIL; RETURN_MODULE_OK; }