From c94cf4486dc191df389177a3c93190e4f24c75d8 Mon Sep 17 00:00:00 2001 From: claudio Date: Sat, 3 Sep 2022 13:30:27 +0000 Subject: [PATCH] Add the repoid of the cert in the cert struct. This way it is possible to track the parent repository id of a publication point. Nomenclature is confusing but not much we can do here. OK tb@ job@ --- usr.sbin/rpki-client/cert.c | 4 +++- usr.sbin/rpki-client/extern.h | 3 ++- usr.sbin/rpki-client/parser.c | 6 ++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/usr.sbin/rpki-client/cert.c b/usr.sbin/rpki-client/cert.c index e0e145282fd..f86f611cb9e 100644 --- a/usr.sbin/rpki-client/cert.c +++ b/usr.sbin/rpki-client/cert.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cert.c,v 1.86 2022/09/03 13:01:43 tb Exp $ */ +/* $OpenBSD: cert.c,v 1.87 2022/09/03 13:30:27 claudio Exp $ */ /* * Copyright (c) 2022 Theo Buehler * Copyright (c) 2021 Job Snijders @@ -905,6 +905,7 @@ cert_buffer(struct ibuf *b, const struct cert *p) io_simple_buffer(b, &p->expires, sizeof(p->expires)); io_simple_buffer(b, &p->purpose, sizeof(p->purpose)); io_simple_buffer(b, &p->talid, sizeof(p->talid)); + io_simple_buffer(b, &p->repoid, sizeof(p->repoid)); io_simple_buffer(b, &p->ipsz, sizeof(p->ipsz)); io_simple_buffer(b, &p->asz, sizeof(p->asz)); @@ -937,6 +938,7 @@ cert_read(struct ibuf *b) io_read_buf(b, &p->expires, sizeof(p->expires)); io_read_buf(b, &p->purpose, sizeof(p->purpose)); io_read_buf(b, &p->talid, sizeof(p->talid)); + io_read_buf(b, &p->repoid, sizeof(p->repoid)); io_read_buf(b, &p->ipsz, sizeof(p->ipsz)); io_read_buf(b, &p->asz, sizeof(p->asz)); diff --git a/usr.sbin/rpki-client/extern.h b/usr.sbin/rpki-client/extern.h index f6d5a3b512b..bf5ee0fb91a 100644 --- a/usr.sbin/rpki-client/extern.h +++ b/usr.sbin/rpki-client/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.153 2022/09/02 19:10:36 claudio Exp $ */ +/* $OpenBSD: extern.h,v 1.154 2022/09/03 13:30:27 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -137,6 +137,7 @@ struct cert { struct cert_as *as; /* list of AS numbers and ranges */ size_t asz; /* length of "asz" */ int talid; /* cert is covered by which TAL */ + unsigned int repoid; /* repository of this cert file */ char *repo; /* CA repository (rsync:// uri) */ char *mft; /* manifest (rsync:// uri) */ char *notify; /* RRDP notify (https:// uri) */ diff --git a/usr.sbin/rpki-client/parser.c b/usr.sbin/rpki-client/parser.c index f6f05ae73cf..cf8e7b0e364 100644 --- a/usr.sbin/rpki-client/parser.c +++ b/usr.sbin/rpki-client/parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.75 2022/08/30 18:56:49 job Exp $ */ +/* $OpenBSD: parser.c,v 1.76 2022/09/03 13:30:27 claudio Exp $ */ /* * Copyright (c) 2019 Claudio Jeker * Copyright (c) 2019 Kristaps Dzonsons @@ -596,8 +596,10 @@ parse_entity(struct entityq *q, struct msgbuf *msgq) cert = proc_parser_cert(file, f, flen); c = (cert != NULL); io_simple_buffer(b, &c, sizeof(int)); - if (cert != NULL) + if (cert != NULL) { + cert->repoid = entp->repoid; cert_buffer(b, cert); + } /* * The parsed certificate data "cert" is now * managed in the "auths" table, so don't free -- 2.20.1