summaryrefslogtreecommitdiff
path: root/usr.sbin/rpki-client/mft.c
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2024-01-31 06:57:22 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2024-01-31 06:57:22 +0000
commit007353c7ce23672b10f73843fa4dd339f21c1279 (patch)
tree4603c82d26efebd5fcfcef81440af4404ca13343 /usr.sbin/rpki-client/mft.c
parentd8a58f6c5a7d5204bbf7277cfe5b44d09669c6b1 (diff)
Introduce and use mft_compare_issued()
Newly issued manifests should not only have a higher manifestNumber, their issuance time should also be later. Add corresponding checks and warnings when comparing a newly fetched manifest to a manifest from the cache. ok job (who noticed that such a check was missing)
Diffstat (limited to 'usr.sbin/rpki-client/mft.c')
-rw-r--r--usr.sbin/rpki-client/mft.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/usr.sbin/rpki-client/mft.c b/usr.sbin/rpki-client/mft.c
index 17ddda63427..a98e6ac33bd 100644
--- a/usr.sbin/rpki-client/mft.c
+++ b/usr.sbin/rpki-client/mft.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mft.c,v 1.101 2024/01/31 06:54:43 tb Exp $ */
+/* $OpenBSD: mft.c,v 1.102 2024/01/31 06:57:21 tb Exp $ */
/*
* Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -545,6 +545,19 @@ mft_read(struct ibuf *b)
}
/*
+ * Compare the thisupdate time of two mft files.
+ */
+int
+mft_compare_issued(const struct mft *a, const struct mft *b)
+{
+ if (a->thisupdate > b->thisupdate)
+ return 1;
+ if (a->thisupdate < b->thisupdate)
+ return -1;
+ return 0;
+}
+
+/*
* Compare the manifestNumber of two mft files.
*/
int