aboutsummaryrefslogtreecommitdiffstats
path: root/URPM/Signature.pm
diff options
context:
space:
mode:
authorJoão Victor Duarte Martins <jvictor@mandriva.com>2010-11-16 12:02:47 +0000
committerJoão Victor Duarte Martins <jvictor@mandriva.com>2010-11-16 12:02:47 +0000
commitd9fad14cf35fe15bbf90f94a6d809d45d8e2ad85 (patch)
tree4b5633a90ae6dce6e4db26e12ee6e9b730ee35b6 /URPM/Signature.pm
parent9da7660b1de431d4baee4f12a224bac3c880a2a7 (diff)
downloadperl-URPM-d9fad14cf35fe15bbf90f94a6d809d45d8e2ad85.tar
perl-URPM-d9fad14cf35fe15bbf90f94a6d809d45d8e2ad85.tar.gz
perl-URPM-d9fad14cf35fe15bbf90f94a6d809d45d8e2ad85.tar.bz2
perl-URPM-d9fad14cf35fe15bbf90f94a6d809d45d8e2ad85.tar.xz
perl-URPM-d9fad14cf35fe15bbf90f94a6d809d45d8e2ad85.zip
(parse_pubkeys_): fix the key parsing to handle PEM encapsulated
header portion (bug #61636)
Diffstat (limited to 'URPM/Signature.pm')
-rw-r--r--URPM/Signature.pm37
1 files changed, 22 insertions, 15 deletions
diff --git a/URPM/Signature.pm b/URPM/Signature.pm
index b050f91..003af07 100644
--- a/URPM/Signature.pm
+++ b/URPM/Signature.pm
@@ -25,25 +25,32 @@ sub parse_pubkeys_ {
$db->traverse_tag('name', [ 'gpg-pubkey' ], sub {
my ($p) = @_;
+ # the first blank separates the PEM headers from key data, this
+ # flags we found it:
+ my $found_blank = 0;
foreach (split "\n", $p->description) {
- $block ||= /^-----BEGIN PGP PUBLIC KEY BLOCK-----$/;
if ($block) {
- my $inside_block = /^$/ ... /^-----END PGP PUBLIC KEY BLOCK-----$/;
- if ($inside_block > 1) {
- if ($inside_block =~ /E/) {
- $keys{$p->version} = {
- $p->summary =~ /^gpg\((.*)\)$/ ? (name => $1) : @{[]},
- id => $p->version,
- content => $content,
- block => $p->description,
- };
- $block = undef;
- $content = '';
- } else {
- $content .= $_;
- }
+ if (/^$/ and not $found_blank) {
+ # All content until now were the encapsulated pem
+ # headers...
+ $content = '';
+ $found_blank = 1;
+ }
+ elsif (/^-----END PGP PUBLIC KEY BLOCK-----$/) {
+ $keys{$p->version} = {
+ $p->summary =~ /^gpg\((.*)\)$/ ? (name => $1) : @{[]},
+ id => $p->version,
+ content => $content,
+ block => $p->description,
+ };
+ $block = undef;
+ $content = '';
+ }
+ else {
+ $content .= $_;
}
}
+ $block ||= /^-----BEGIN PGP PUBLIC KEY BLOCK-----$/;
}
});