]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 2681] Fix display of certificate EOValidity dates on 32-bit systems
authorHarlan Stenn <stenn@ntp.org>
Thu, 1 Jan 2015 07:31:57 +0000 (07:31 +0000)
committerHarlan Stenn <stenn@ntp.org>
Thu, 1 Jan 2015 07:31:57 +0000 (07:31 +0000)
bk: 54a4f7edzhsHqUgLel-tk7RWwN_Tlw

ChangeLog
ntpd/ntp_control.c

index f399e724756f028792e9b3c8ff0e4342042f4260..275c2563948b7b859940a1959ecc61ff413e060b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 ---
 
+* [Bug 2681] Fix display of certificate EOValidity dates on 32-bit systems.
 * [Bug 2695] 4.2.8 does not build on Windows.
 ---
 (4.2.8p1-beta2) 2014/12/27 Released by Harlan Stenn <stenn@ntp.org>
index f5f326ca48113f24a5a03f5e3ff0bc1644081e25..5a11691d7c1f4aa4a5bbfea02193c0f9b330eee6 100644 (file)
@@ -1483,6 +1483,33 @@ ctl_putuint(
        ctl_putdata(buffer, (unsigned)( cp - buffer ), 0);
 }
 
+/*
+ * ctl_putcal - write a decoded calendar data into the response
+ */
+static void
+ctl_putcal(
+       const char *tag,
+       const struct calendar *pcal
+       )
+{
+       char buffer[100];
+       unsigned numch;
+
+       numch = snprintf(buffer, sizeof(buffer),
+                       "%s=%04d%02d%02d%02d%02d",
+                       tag,
+                       pcal->year,
+                       pcal->month,
+                       pcal->monthday,
+                       pcal->hour,
+                       pcal->minute
+                       );
+       NTP_INSIST(numch < sizeof(buffer));
+       ctl_putdata(buffer, numch, 0);
+
+       return;
+}
+
 /*
  * ctl_putfs - write a decoded filestamp into the response
  */
@@ -2334,14 +2361,11 @@ ctl_putsys(
 
        case CS_CERTIF:
                for (cp = cinfo; cp != NULL; cp = cp->link) {
-                       tstamp_t tstamp;
-
                        snprintf(str, sizeof(str), "%s %s 0x%x",
                            cp->subject, cp->issuer, cp->flags);
                        ctl_putstr(sys_var[CS_CERTIF].text, str,
                            strlen(str));
-                       tstamp = caltontp(&(cp->last)); /* XXX too small to hold some values, but that's what ctl_putfs requires */
-                       ctl_putfs(sys_var[CS_REVTIME].text, tstamp);
+                       ctl_putcal(sys_var[CS_REVTIME].text, &(cp->last));
                }
                break;