[PATCH] Switch from os_get_time(...) to os_get_reltime(...) to avoid malfunction if-and-when the system clock shifts.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Switch from os_get_time(...) to os_get_reltime(...) to avoid
malfunction if-and-when the system clock shifts.

Signed-off-by: Nick Lowe <nick.lowe@xxxxxxxxxxxx>
---
 src/eap_server/eap_server_fast.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/eap_server/eap_server_fast.c b/src/eap_server/eap_server_fast.c
index 6993159..a8c57d5 100644
--- a/src/eap_server/eap_server_fast.c
+++ b/src/eap_server/eap_server_fast.c
@@ -127,7 +127,7 @@ static int eap_fast_session_ticket_cb(void *ctx,
const u8 *ticket, size_t len,
  size_t pac_opaque_len;
  u8 *buf, *pos, *end, *pac_key = NULL;
  os_time_t lifetime = 0;
- struct os_time now;
+ struct os_reltime now;
  u8 *identity = NULL;
  size_t identity_len = 0;

@@ -242,7 +242,7 @@ done:
  }
  }

- if (os_get_time(&now) < 0 || lifetime <= 0 || now.sec > lifetime) {
+ if (os_get_reltime(&now) < 0 || lifetime <= 0 || now.sec > lifetime) {
  wpa_printf(MSG_DEBUG, "EAP-FAST: PAC-Key not valid anymore "
    "(lifetime=%ld now=%ld)", lifetime, now.sec);
  data->send_new_pac = 2;
@@ -692,10 +692,10 @@ static struct wpabuf * eap_fast_build_pac(struct
eap_sm *sm,
  struct eap_tlv_hdr *pac_tlv;
  struct pac_tlv_hdr *pac_info;
  struct eap_tlv_result_tlv *result;
- struct os_time now;
+ struct os_reltime now;

  if (random_get_bytes(pac_key, EAP_FAST_PAC_KEY_LEN) < 0 ||
-    os_get_time(&now) < 0)
+    os_get_reltime(&now) < 0)
  return NULL;
  wpa_hexdump_key(MSG_DEBUG, "EAP-FAST: Generated PAC-Key",
  pac_key, EAP_FAST_PAC_KEY_LEN);
-- 
2.5.0

_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux