From d53c6c4741bcc31f5402dcbcaf7a7e4036a67eb1 Mon Sep 17 00:00:00 2001 From: job Date: Thu, 25 Aug 2022 18:12:05 +0000 Subject: [PATCH] Make PEM printing available through increased verbosity (-vvf) Suggestion from claudio@ OK tb@ --- usr.sbin/rpki-client/filemode.c | 5 ++--- usr.sbin/rpki-client/main.c | 12 ++++-------- usr.sbin/rpki-client/rpki-client.8 | 15 +++++++++------ 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/usr.sbin/rpki-client/filemode.c b/usr.sbin/rpki-client/filemode.c index 86a82038637..95993b05f98 100644 --- a/usr.sbin/rpki-client/filemode.c +++ b/usr.sbin/rpki-client/filemode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: filemode.c,v 1.11 2022/08/25 17:31:26 job Exp $ */ +/* $OpenBSD: filemode.c,v 1.12 2022/08/25 18:12:05 job Exp $ */ /* * Copyright (c) 2019 Claudio Jeker * Copyright (c) 2019 Kristaps Dzonsons @@ -40,7 +40,6 @@ #include "extern.h" -extern int printpem; extern int verbose; static X509_STORE_CTX *ctx; @@ -436,7 +435,7 @@ proc_parser_file(char *file, unsigned char *buf, size_t len) errx(1, "X509_print_fp"); } - if (printpem) { + if (verbose > 1) { if (!PEM_write_X509(stdout, x509)) errx(1, "PEM_write_X509"); } diff --git a/usr.sbin/rpki-client/main.c b/usr.sbin/rpki-client/main.c index a96345007e2..113a20c928a 100644 --- a/usr.sbin/rpki-client/main.c +++ b/usr.sbin/rpki-client/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.210 2022/08/25 17:31:26 job Exp $ */ +/* $OpenBSD: main.c,v 1.211 2022/08/25 18:12:05 job Exp $ */ /* * Copyright (c) 2021 Claudio Jeker * Copyright (c) 2019 Kristaps Dzonsons @@ -64,7 +64,6 @@ const char *bird_tablename = "ROAS"; int verbose; int noop; int filemode; -int printpem; int rrdpon = 1; int repo_timeout; @@ -820,7 +819,7 @@ main(int argc, char *argv[]) "proc exec unveil", NULL) == -1) err(1, "pledge"); - while ((c = getopt(argc, argv, "b:Bcd:e:fjnoprRs:S:t:T:vV")) != -1) + while ((c = getopt(argc, argv, "b:Bcd:e:fjnorRs:S:t:T:vV")) != -1) switch (c) { case 'b': bind_addr = optarg; @@ -850,9 +849,6 @@ main(int argc, char *argv[]) case 'o': outformats |= FORMAT_OPENBGPD; break; - case 'p': - printpem = 1; - break; case 'R': rrdpon = 0; break; @@ -1282,7 +1278,7 @@ usage: " [-e rsync_prog]\n" " [-S skiplist] [-s timeout] [-T table] [-t tal]" " [outputdir]\n" - " rpki-client [-Vv] [-d cachedir] [-j | -p] [-t tal] -f file" - " ...\n"); + " rpki-client [-Vv] [-d cachedir] [-j] [-t tal] -f file ..." + "\n"); return 1; } diff --git a/usr.sbin/rpki-client/rpki-client.8 b/usr.sbin/rpki-client/rpki-client.8 index a363d4cdede..57fdcbb6f07 100644 --- a/usr.sbin/rpki-client/rpki-client.8 +++ b/usr.sbin/rpki-client/rpki-client.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: rpki-client.8,v 1.69 2022/08/25 17:31:26 job Exp $ +.\" $OpenBSD: rpki-client.8,v 1.70 2022/08/25 18:12:05 job Exp $ .\" .\" Copyright (c) 2019 Kristaps Dzonsons .\" @@ -34,7 +34,7 @@ .Nm .Op Fl Vv .Op Fl d Ar cachedir -.Op Fl j | p +.Op Fl j .Op Fl t Ar tal .Fl f .Ar @@ -145,8 +145,6 @@ If the and .Fl j options are not specified this is the default. -.It Fl p -Print the encapsulated X.509 certificate in PEM format. .It Fl R Synchronize via RSYNC only. .It Fl r @@ -199,8 +197,13 @@ will load all TAL files in .It Fl V Show the version and exit. .It Fl v -Specified once, prints information about status. -Twice, prints each filename as it's processed. +Increase verbosity. +Specify once for synchronisation status, twice to print the name of each file +as it's processed. +If +.Fl f +is given, specify once to print more information about the encapsulated X.509 +certificate, twice to print the certificate in PEM format. .It Ar outputdir The directory where .Nm -- 2.20.1