From 66a3a4500e333de91dc607edfecf2fb54adf695d Mon Sep 17 00:00:00 2001 From: job Date: Wed, 20 Apr 2022 15:13:08 +0000 Subject: [PATCH] Improve proc_parser_file handling of Trust Anchors OK tb@ --- usr.sbin/rpki-client/parser.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/usr.sbin/rpki-client/parser.c b/usr.sbin/rpki-client/parser.c index 7751bc1a3a9..d11d044c0fd 100644 --- a/usr.sbin/rpki-client/parser.c +++ b/usr.sbin/rpki-client/parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.70 2022/04/20 10:46:20 job Exp $ */ +/* $OpenBSD: parser.c,v 1.71 2022/04/20 15:13:08 job Exp $ */ /* * Copyright (c) 2019 Claudio Jeker * Copyright (c) 2019 Kristaps Dzonsons @@ -1146,6 +1146,13 @@ proc_parser_file(char *file, unsigned char *buf, size_t len) cert = ta_parse(file, cert, tal->pkey, tal->pkeysz); if (cert != NULL) printf("OK"); + else + printf("Failed"); + if (outformats & FORMAT_JSON) + printf("\",\n\t\"tal\": \"%s", tal->descr); + else + printf("\nTAL: %s", tal->descr); + tal = NULL; } else { cert_free(cert); cert = NULL; @@ -1153,16 +1160,8 @@ proc_parser_file(char *file, unsigned char *buf, size_t len) } } - if (is_ta) { - if (outformats & FORMAT_JSON) { - printf("\",\n\t\"tal\": \"%s\"\n", tal->descr); - printf("}"); - } else { - printf("\nTAL: %s\n", tal->descr); - } - tal = NULL; - } else if (outformats & FORMAT_JSON) - printf("\"\n}"); + if (outformats & FORMAT_JSON) + printf("\"\n}"); else printf("\n"); -- 2.20.1