From 4dfb12e713baf5a0a8586da60fceadfa0cd8cc25 Mon Sep 17 00:00:00 2001 From: job Date: Fri, 2 Feb 2024 19:26:26 +0000 Subject: [PATCH] no longer check staleness in proc_parser_mft invert logic for readability OK tb@ --- usr.sbin/rpki-client/parser.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/usr.sbin/rpki-client/parser.c b/usr.sbin/rpki-client/parser.c index f07de4775bb..26163d3ec3e 100644 --- a/usr.sbin/rpki-client/parser.c +++ b/usr.sbin/rpki-client/parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.123 2024/02/02 18:59:35 tb Exp $ */ +/* $OpenBSD: parser.c,v 1.124 2024/02/02 19:26:26 job Exp $ */ /* * Copyright (c) 2019 Claudio Jeker * Copyright (c) 2019 Kristaps Dzonsons @@ -400,19 +400,14 @@ proc_parser_mft(struct entity *entp, struct mft **mp, char **crlfile, } if (mft1 != NULL) { - if (!mft1->stale) { - if (!proc_parser_mft_check(file1, mft1)) { - mft_free(mft1); - mft1 = NULL; - if (mft2 != NULL) - warnx("%s: failed fetch, continuing " - "with #%s from cache", file2, - mft2->seqnum); - } + if (proc_parser_mft_check(file1, mft1)) { *mp = mft1; } else { - /* XXX - preserve behavior; this is probably wrong. */ - *mp = mft1; + mft_free(mft1); + mft1 = NULL; + if (mft2 != NULL) + warnx("%s: failed fetch, continuing with #%s " + "from cache", file2, mft2->seqnum); } } @@ -427,13 +422,12 @@ proc_parser_mft(struct entity *entp, struct mft **mp, char **crlfile, *crlfile = crl1file; } else { if (mft2 != NULL) { - if (!mft2->stale) { - if (!proc_parser_mft_check(file2, mft2)) { - mft_free(mft2); - mft2 = NULL; - } + if (proc_parser_mft_check(file2, mft2)) { + *mp = mft2; + } else { + mft_free(mft2); + mft2 = NULL; } - *mp = mft2; } else { if (err2 == NULL) err2 = err1; -- 2.20.1