diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2024-01-31 06:57:22 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2024-01-31 06:57:22 +0000 |
commit | 007353c7ce23672b10f73843fa4dd339f21c1279 (patch) | |
tree | 4603c82d26efebd5fcfcef81440af4404ca13343 /usr.sbin/rpki-client/mft.c | |
parent | d8a58f6c5a7d5204bbf7277cfe5b44d09669c6b1 (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.c | 15 |
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 |