From: claudio Date: Mon, 1 Nov 2021 09:12:18 +0000 (+0000) Subject: Cleanup struct auth a bit. The tal description is also stored in the cert X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=cebe8259859c5182dfb8eacf80464b43532b4c4d;p=openbsd Cleanup struct auth a bit. The tal description is also stored in the cert and the filename is only used in tracewarn which is not that helpful. OK tb@ --- diff --git a/usr.sbin/rpki-client/extern.h b/usr.sbin/rpki-client/extern.h index c8c4cfac6c9..43858a5722c 100644 --- a/usr.sbin/rpki-client/extern.h +++ b/usr.sbin/rpki-client/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.86 2021/10/29 09:27:36 claudio Exp $ */ +/* $OpenBSD: extern.h,v 1.87 2021/11/01 09:12:18 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -270,8 +270,6 @@ struct auth { RB_ENTRY(auth) entry; struct cert *cert; /* owner information */ struct auth *parent; /* pointer to parent or NULL for TA cert */ - char *tal; /* basename of TAL for this cert */ - char *fn; /* FIXME: debugging */ }; /* * Tree of auth sorted by ski diff --git a/usr.sbin/rpki-client/parser.c b/usr.sbin/rpki-client/parser.c index 7c72f9cdb73..4818354f3bc 100644 --- a/usr.sbin/rpki-client/parser.c +++ b/usr.sbin/rpki-client/parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.21 2021/10/28 09:02:19 beck Exp $ */ +/* $OpenBSD: parser.c,v 1.22 2021/11/01 09:12:18 claudio Exp $ */ /* * Copyright (c) 2019 Claudio Jeker * Copyright (c) 2019 Kristaps Dzonsons @@ -248,21 +248,14 @@ proc_parser_cert(const struct entity *entp, const unsigned char *der, */ cert->valid = 1; + if ((cert->tal = strdup(a->cert->tal)) == NULL) + err(1, NULL); na = malloc(sizeof(*na)); if (na == NULL) err(1, NULL); - - cert->tal = strdup(a->tal); - if (cert->tal == NULL) - err(1, NULL); - na->parent = a; na->cert = cert; - na->tal = a->tal; - na->fn = strdup(entp->file); - if (na->fn == NULL) - err(1, NULL); if (RB_INSERT(auth_tree, &auths, na) != NULL) err(1, "auth tree corrupted"); @@ -290,7 +283,6 @@ proc_parser_root_cert(const struct entity *entp, const unsigned char *der, struct cert *cert; X509 *x509; struct auth *na; - char *tal; assert(entp->has_data); @@ -340,20 +332,14 @@ proc_parser_root_cert(const struct entity *entp, const unsigned char *der, */ cert->valid = 1; + if ((cert->tal = strdup(entp->descr)) == NULL) + err(1, NULL); na = malloc(sizeof(*na)); if (na == NULL) err(1, NULL); - - if ((tal = strdup(entp->descr)) == NULL) - err(1, NULL); - na->parent = NULL; na->cert = cert; - na->tal = tal; - na->fn = strdup(entp->file); - if (na->fn == NULL) - err(1, NULL); if (RB_INSERT(auth_tree, &auths, na) != NULL) err(1, "auth tree corrupted"); diff --git a/usr.sbin/rpki-client/validate.c b/usr.sbin/rpki-client/validate.c index a6df8e6e0d9..cf58d249845 100644 --- a/usr.sbin/rpki-client/validate.c +++ b/usr.sbin/rpki-client/validate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: validate.c,v 1.20 2021/10/29 09:27:36 claudio Exp $ */ +/* $OpenBSD: validate.c,v 1.21 2021/11/01 09:12:18 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -30,14 +30,6 @@ #include "extern.h" -static void -tracewarn(const struct auth *a) -{ - - for (; a != NULL; a = a->parent) - warnx(" ...inheriting from: %s", a->fn); -} - /* * Walk up the chain of certificates trying to match our AS number to * one of the allocations in that chain. @@ -176,7 +168,6 @@ valid_cert(const char *fn, struct auth_tree *auths, const struct cert *cert) continue; warnx("%s: RFC 6487: uncovered AS: " "%u--%u", fn, min, max); - tracewarn(a); return 0; } @@ -204,7 +195,6 @@ valid_cert(const char *fn, struct auth_tree *auths, const struct cert *cert) "(inherit)", fn); break; } - tracewarn(a); return 0; } @@ -227,7 +217,7 @@ valid_roa(const char *fn, struct auth_tree *auths, struct roa *roa) if (a == NULL) return 0; - if ((roa->tal = strdup(a->tal)) == NULL) + if ((roa->tal = strdup(a->cert->tal)) == NULL) err(1, NULL); for (i = 0; i < roa->ipsz; i++) { @@ -238,7 +228,6 @@ valid_roa(const char *fn, struct auth_tree *auths, struct roa *roa) roa->ips[i].afi, buf, sizeof(buf)); warnx("%s: RFC 6482: uncovered IP: " "%s", fn, buf); - tracewarn(a); return 0; }