diff options
author | Stuart Henderson <sthen@cvs.openbsd.org> | 2018-03-21 15:23:54 +0000 |
---|---|---|
committer | Stuart Henderson <sthen@cvs.openbsd.org> | 2018-03-21 15:23:54 +0000 |
commit | be101b09bb25a4fddd4e49578723ac00a4751fe9 (patch) | |
tree | 4534191496eb9b8353fe2d72c62adc6217977efc /lib/libcrypto | |
parent | 899651b3c56e595ec2bb1adbd5e619d1d97dc076 (diff) |
Adjust (non-installed) helper script to cope better with CAs that don't have
"o=" in their subject.
Diffstat (limited to 'lib/libcrypto')
-rw-r--r-- | lib/libcrypto/format-pem.pl | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libcrypto/format-pem.pl b/lib/libcrypto/format-pem.pl index 6c689d4978d..556178eb30f 100644 --- a/lib/libcrypto/format-pem.pl +++ b/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 <sthen@openbsd.org> # @@ -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`; |