[PATCH 3/4] ssh-keygen: make verify-time argument parsing optional
Fabian Stelzer
fs at gigacodes.de
Fri Oct 22 00:54:26 AEDT 2021
Signed-off-by: Fabian Stelzer <fs at gigacodes.de>
---
ssh-keygen.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 9b912f0a..927a1d62 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -2680,11 +2680,13 @@ sig_process_opts(char * const *opts, size_t nopts, uint64_t *verify_timep,
size_t i;
time_t now;
- *verify_timep = 0;
+ if (verify_timep != NULL)
+ *verify_timep = 0;
if (print_pubkey != NULL)
*print_pubkey = 0;
for (i = 0; i < nopts; i++) {
- if (strncasecmp(opts[i], "verify-time=", 12) == 0) {
+ if (verify_timep &&
+ strncasecmp(opts[i], "verify-time=", 12) == 0) {
if (parse_absolute_time(opts[i] + 12,
verify_timep) != 0 || *verify_timep == 0) {
error("Invalid \"verify-time\" option");
@@ -2698,7 +2700,7 @@ sig_process_opts(char * const *opts, size_t nopts, uint64_t *verify_timep,
return SSH_ERR_INVALID_ARGUMENT;
}
}
- if (*verify_timep == 0) {
+ if (verify_timep && *verify_timep == 0) {
if ((now = time(NULL)) < 0) {
error("Time is before epoch");
return SSH_ERR_INVALID_ARGUMENT;
--
2.31.1
More information about the openssh-unix-dev
mailing list