Bugzilla – Attachment 3531 Details for
Bug 3329
Certificate validity dates greater than 32bit are truncated to 2038-01-19T03:14:07
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
allow formatting dates >INT_MAX
ssh-key-validity-format.patch (text/plain), 2.00 KB, created by
Darren Tucker
on 2021-07-02 13:57:57 AEST
(
hide
)
Description:
allow formatting dates >INT_MAX
Filename:
MIME Type:
Creator:
Darren Tucker
Created:
2021-07-02 13:57:57 AEST
Size:
2.00 KB
patch
obsolete
>Index: sshkey.c >=================================================================== >RCS file: /export/cvs/src/usr.bin/ssh/sshkey.c,v >retrieving revision 1.116 >diff -u -p -r1.116 sshkey.c >--- sshkey.c 3 Apr 2021 06:18:41 -0000 1.116 >+++ sshkey.c 2 Jul 2021 03:27:45 -0000 >@@ -3115,28 +3115,16 @@ size_t > sshkey_format_cert_validity(const struct sshkey_cert *cert, char *s, size_t l) > { > char from[32], to[32], ret[128]; >- time_t tt; >- struct tm *tm; > > *from = *to = '\0'; > if (cert->valid_after == 0 && > cert->valid_before == 0xffffffffffffffffULL) > return strlcpy(s, "forever", l); > >- if (cert->valid_after != 0) { >- /* XXX revisit INT_MAX in 2038 :) */ >- tt = cert->valid_after > INT_MAX ? >- INT_MAX : cert->valid_after; >- tm = localtime(&tt); >- strftime(from, sizeof(from), "%Y-%m-%dT%H:%M:%S", tm); >- } >- if (cert->valid_before != 0xffffffffffffffffULL) { >- /* XXX revisit INT_MAX in 2038 :) */ >- tt = cert->valid_before > INT_MAX ? >- INT_MAX : cert->valid_before; >- tm = localtime(&tt); >- strftime(to, sizeof(to), "%Y-%m-%dT%H:%M:%S", tm); >- } >+ if (cert->valid_after != 0) >+ format_absolute_time(cert->valid_after, from, sizeof(from)); >+ if (cert->valid_before != 0xffffffffffffffffULL) >+ format_absolute_time(cert->valid_before, to, sizeof(to)); > > if (cert->valid_after == 0) > snprintf(ret, sizeof(ret), "before %s", to); >Index: misc.c >=================================================================== >RCS file: /export/cvs/src/usr.bin/ssh/misc.c,v >retrieving revision 1.166 >diff -u -p -r1.166 misc.c >--- misc.c 8 Jun 2021 06:54:40 -0000 1.166 >+++ misc.c 2 Jul 2021 03:46:33 -0000 >@@ -2284,10 +2284,15 @@ parse_absolute_time(const char *s, uint6 > return 0; > } > >+/* On OpenBSD time_t is int64_t which is long long. */ >+#ifndef TIME_T_MAX >+# define TIME_T_MAX LLONG_MAX >+#endif >+ > void > format_absolute_time(uint64_t t, char *buf, size_t len) > { >- time_t tt = t > INT_MAX ? INT_MAX : t; /* XXX revisit in 2038 :P */ >+ time_t tt = t > TIME_T_MAX ? TIME_T_MAX : t; > struct tm tm; > > localtime_r(&tt, &tm);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 3329
:
3531
|
3532