aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer Øyvind Karlsen <peroyvind@mandriva.org>2010-11-17 22:34:00 +0000
committerPer Øyvind Karlsen <peroyvind@mandriva.org>2010-11-17 22:34:00 +0000
commit1a85d5e16dc59ca42a5669a517685f9d1839f965 (patch)
treee54041dafe3de2b60ce16e2dd57f947f5c780fcd
parentdc4e3c0dd4d8ae9420ff82d5da8b7080a4334f60 (diff)
downloadperl-URPM-1a85d5e16dc59ca42a5669a517685f9d1839f965.tar
perl-URPM-1a85d5e16dc59ca42a5669a517685f9d1839f965.tar.gz
perl-URPM-1a85d5e16dc59ca42a5669a517685f9d1839f965.tar.bz2
perl-URPM-1a85d5e16dc59ca42a5669a517685f9d1839f965.tar.xz
perl-URPM-1a85d5e16dc59ca42a5669a517685f9d1839f965.zip
(parse_pubkeys_): fix the key parsing to handle PEM encapsulated
header portion (bug #61636) (Joao Victor Martins)
-rw-r--r--NEWS5
-rw-r--r--URPM/Signature.pm37
2 files changed, 27 insertions, 15 deletions
diff --git a/NEWS b/NEWS
index 57ae770..4ae47a7 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,11 @@ Version 4.0 - 11 Nov 2010, by Per Øyvind Karlsen
- refactorize code
- rewrite for native rpm5 API (ditching rpm.org compatibility)
+Version 3.38 - 16 November 2010, by Joao Victor Martins
+
+- fix the key parsing to handle PEM encapsulated header portion (bug
+#61636)
+
Version 3.37 - 20 October 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-----$/;
}
});