[Git][NTPsec/ntpsec][master] NTS: fix cookie key-rotation timer logic

Hal Murray gitlab at mg.gitlab.com
Wed Mar 20 10:34:53 UTC 2019



Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
565b64e8 by Hal Murray at 2019-03-20T10:33:39Z
NTS: fix cookie key-rotation timer logic

- - - - -


1 changed file:

- ntpd/nts_cookie.c


Changes:

=====================================
ntpd/nts_cookie.c
=====================================
@@ -131,7 +131,6 @@ bool nts_cookie_init2(void) {
 #define SecondsPerDay 3600
 void nts_timer(void) {
   time_t now;
-  long int steps;
   if (0 == K_time)
     return;
   now = time(NULL);
@@ -139,8 +138,8 @@ void nts_timer(void) {
     return;
   nts_make_cookie_key();
   /* In case we were off for many days. */
-  steps = (now-K_time) % SecondsPerDay;
-  K_time += steps*SecondsPerDay;
+  while (SecondsPerDay < (now-K_time))
+    K_time += SecondsPerDay;
   if (nts_write_cookie_keys() )
     msyslog(LOG_INFO, "NTS: Wrote new cookie key.");
   else



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/565b64e8c56b11e9347fdb0a82936e9236591256

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/565b64e8c56b11e9347fdb0a82936e9236591256
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20190320/8b40cbbd/attachment.html>


More information about the vc mailing list