From: Alan T. DeKok Date: Wed, 8 Sep 2021 12:47:06 +0000 (-0400) Subject: use request->packet->timestamp instead of time(NULL) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b638fd79314fa36e5fb599d881a04c4d02376264;p=thirdparty%2Ffreeradius-server.git use request->packet->timestamp instead of time(NULL) --- diff --git a/src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c b/src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c index e00723ebfb..ccc3ac29fa 100644 --- a/src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c +++ b/src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c @@ -170,7 +170,7 @@ static void eap_fast_send_pac_tunnel(request_t *request, fr_tls_session_t *tls_s pac.info.lifetime.hdr.type = htons(attr_eap_fast_pac_info_pac_lifetime->attr); pac.info.lifetime.hdr.length = htons(sizeof(pac.info.lifetime.data)); - pac.info.lifetime.data = htonl(time(NULL) + t->pac_lifetime); + pac.info.lifetime.data = htonl(fr_time_to_sec(request->packet->timestamp) + t->pac_lifetime); pac.info.a_id.hdr.type = htons(EAP_FAST_TLV_MANDATORY | attr_eap_fast_pac_a_id->attr); pac.info.a_id.hdr.length = htons(sizeof(pac.info.a_id.data)); @@ -937,7 +937,7 @@ fr_radius_packet_code_t eap_fast_process(request_t *request, eap_session_t *eap_ t->mode = EAP_FAST_PROVISIONING_AUTH; } - if (!t->pac.expires || t->pac.expired || t->pac.expires - time(NULL) < t->pac_lifetime * 0.6) { + if (!t->pac.expires || t->pac.expired || (t->pac.expires - fr_time_to_sec(request->packet->timestamp)) < (t->pac_lifetime * 6) / 10) { t->pac.send = true; } } diff --git a/src/modules/rlm_eap/types/rlm_eap_fast/rlm_eap_fast.c b/src/modules/rlm_eap/types/rlm_eap_fast/rlm_eap_fast.c index 7ee73822ad..98175ab209 100644 --- a/src/modules/rlm_eap/types/rlm_eap_fast/rlm_eap_fast.c +++ b/src/modules/rlm_eap/types/rlm_eap_fast/rlm_eap_fast.c @@ -335,7 +335,7 @@ error: } else if (vp->da == attr_eap_fast_pac_info_pac_lifetime) { fr_assert(t->pac.expires == 0); t->pac.expires = vp->vp_uint32; - t->pac.expired = (vp->vp_uint32 <= time(NULL)); + t->pac.expired = (vp->vp_uint32 <= fr_time_to_sec(request->packet->timestamp)); /* * Not sure if this is the correct attr * The original enum didn't match a specific TLV nesting level