From 5f464127d06a3eea265cb6fff6b04c272e54017d Mon Sep 17 00:00:00 2001 From: sthen <> Date: Wed, 21 Mar 2018 15:23:53 +0000 Subject: Adjust (non-installed) helper script to cope better with CAs that don't have "o=" in their subject. --- src/lib/libcrypto/format-pem.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/libcrypto/format-pem.pl b/src/lib/libcrypto/format-pem.pl index 6c689d4978..556178eb30 100644 --- a/src/lib/libcrypto/format-pem.pl +++ b/src/lib/libcrypto/format-pem.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $OpenBSD: format-pem.pl,v 1.1 2016/12/15 10:23:21 sthen Exp $ +# $OpenBSD: format-pem.pl,v 1.2 2018/03/21 15:23:53 sthen Exp $ # # Copyright (c) 2016 Stuart Henderson # @@ -50,7 +50,11 @@ while(<>) { if ($issuer ne $subj); my $o = `openssl x509 -in $t -noout -nameopt sep_multiline,use_quote,esc_msb -subject`; - $o =~ s/.*O=([^\n]*).*/$1/sm; + if ($o =~ /O=/) { + $o =~ s/.*O=([^\n]*).*/$1/sm; + } else { + $o = $subj; + } if (eval {require Date::Parse;1;}) { my $startdate = `openssl x509 -in $t -startdate -noout`; -- cgit v1.2.3-55-g6feb