From: Harlan Stenn Date: Thu, 1 Jan 2015 07:31:57 +0000 (+0000) Subject: [Bug 2681] Fix display of certificate EOValidity dates on 32-bit systems X-Git-Tag: NTP_4_2_8P1_BETA3~3^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74827ad61a86a2083d969dbdb34b4c89dfa472a9;p=thirdparty%2Fntp.git [Bug 2681] Fix display of certificate EOValidity dates on 32-bit systems bk: 54a4f7edzhsHqUgLel-tk7RWwN_Tlw --- diff --git a/ChangeLog b/ChangeLog index f399e7247..275c25639 100644 --- 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 diff --git a/ntpd/ntp_control.c b/ntpd/ntp_control.c index f5f326ca4..5a11691d7 100644 --- a/ntpd/ntp_control.c +++ b/ntpd/ntp_control.c @@ -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;