aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Victor Duarte Martins <jvictor@mandriva.com>2010-11-18 19:23:04 +0000
committerJoão Victor Duarte Martins <jvictor@mandriva.com>2010-11-18 19:23:04 +0000
commit464891d625aaf89e249fb51ffc69216494256ff8 (patch)
tree0be2746db7b2d876d5b53857e088119842aac23b
parent0818d6645164acf22bbd1be7e91e561405b6b0f2 (diff)
downloadperl-URPM-464891d625aaf89e249fb51ffc69216494256ff8.tar
perl-URPM-464891d625aaf89e249fb51ffc69216494256ff8.tar.gz
perl-URPM-464891d625aaf89e249fb51ffc69216494256ff8.tar.bz2
perl-URPM-464891d625aaf89e249fb51ffc69216494256ff8.tar.xz
perl-URPM-464891d625aaf89e249fb51ffc69216494256ff8.zip
(parse_pubkeys_): fix the key parsing to handle PEM encapsulated
header portion (bug #61636)
-rw-r--r--NEWS3
-rw-r--r--URPM/Signature.pm37
2 files changed, 25 insertions, 15 deletions
diff --git a/NEWS b/NEWS
index fa09bfb..5b0a86a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+- fix the key parsing to handle PEM encapsulated header portion (bug
+ #61636)
+
Version 3.37 - 20 September 2010
- fix crashing on undefined packages (#54521)
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-----$/;
}
});