]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
use packet timestamp as "now"
authorAlan T. DeKok <aland@freeradius.org>
Wed, 8 Sep 2021 12:36:34 +0000 (08:36 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 8 Sep 2021 12:36:34 +0000 (08:36 -0400)
instead of whenever we got around to processing the request.
this is more likely to be what the user intended

src/modules/rlm_totp/rlm_totp.c

index 814154ceb04609aa714524fb8f44c44fcb83a898..acad3a876883dca1e0d73a4b6e8936d97cb9ba72 100644 (file)
@@ -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;
 }