diff options
Diffstat (limited to 'usr.sbin/rpki-client/main.c')
-rw-r--r-- | usr.sbin/rpki-client/main.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/usr.sbin/rpki-client/main.c b/usr.sbin/rpki-client/main.c index 110fb94a485..22c1c34001d 100644 --- a/usr.sbin/rpki-client/main.c +++ b/usr.sbin/rpki-client/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.239 2023/05/30 12:12:06 claudio Exp $ */ +/* $OpenBSD: main.c,v 1.240 2023/05/30 12:14:48 claudio Exp $ */ /* * Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org> * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> @@ -74,7 +74,7 @@ int rrdpon = 1; int repo_timeout; time_t deadline; -int64_t evaluation_time; +int64_t evaluation_time = X509_TIME_MIN; struct stats stats; @@ -126,6 +126,14 @@ entity_free(struct entity *ent) free(ent); } +time_t +get_current_time(void) +{ + if (evaluation_time > X509_TIME_MIN) + return (time_t) evaluation_time; + return time(NULL); +} + /* * Read a queue entity from the descriptor. * Matched by entity_buffer_req(). @@ -966,8 +974,6 @@ main(int argc, char *argv[]) "proc exec unveil", NULL) == -1) err(1, "pledge"); - evaluation_time = time(NULL); - while ((c = getopt(argc, argv, "Ab:Bcd:e:fH:jmnoP:rRs:S:t:T:vV")) != -1) switch (c) { case 'A': @@ -1009,7 +1015,7 @@ main(int argc, char *argv[]) outformats |= FORMAT_OPENBGPD; break; case 'P': - evaluation_time = strtonum(optarg, X509_TIME_MIN, + evaluation_time = strtonum(optarg, X509_TIME_MIN + 1, X509_TIME_MAX, &errs); if (errs) errx(1, "-P: time in seconds %s", errs); |