Download raw body.
rpki-client: improve purpose handling
On Sat, Jun 08, 2024 at 05:35:41AM +0200, Theo Buehler wrote:
> @@ -626,7 +627,7 @@ entity_process(struct ibuf *b, struct st
> repo_stat_inc(rp, talid, type, STYPE_BGPSEC);
> break;
> default:
> - errx(1, "unexpected cert purpose received");
> + errx(1, "unexpected %s", purpose2str(cert->purpose));
> break;
> }
> cert_free(cert);
and
> +const char *
> +purpose2str(enum cert_purpose purpose)
> +{
> + switch (purpose) {
> + case CERT_PURPOSE_INVALID:
> + return "invalid cert";
> + case CERT_PURPOSE_TA:
> + return "TA cert";
> + case CERT_PURPOSE_CA:
> + return "CA cert";
> + case CERT_PURPOSE_EE:
> + return "EE cert";
> + case CERT_PURPOSE_BGPSEC_ROUTER:
> + return "BGPsec Router cert";
> + default:
> + return "unknown cert";
> + }
> +}
"unexpected unknown cert" might read a bit awkward, perhaps the
"default:" clause should print "unexpected certificate purpose"?
OK job@
rpki-client: improve purpose handling