diff options
author | Guillem Jover <guillem@debian.org> | 2017-09-27 01:59:22 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2017-10-16 11:04:28 +0200 |
commit | b56eddde1a625feff02ebfb92dff88c96f11d376 (patch) | |
tree | 60ceff1e1d7dd93c4f50c2d13f4c4a5f8b989847 /scripts | |
parent | 63958db6f8a0816539ad98b419775ae1ae00105c (diff) | |
download | dpkg-b56eddde1a625feff02ebfb92dff88c96f11d376.tar.gz |
Dpkg::Control::HashCore: Expect stanza delimiters more often than Armor Headers
Usually we will just have Armor Headers at the beginning and end of the
data, so it's more common to find stanza delimiter lines. Optimize for
that.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Dpkg/Control/HashCore.pm | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/scripts/Dpkg/Control/HashCore.pm b/scripts/Dpkg/Control/HashCore.pm index 91b279d43..a3ea4bc96 100644 --- a/scripts/Dpkg/Control/HashCore.pm +++ b/scripts/Dpkg/Control/HashCore.pm @@ -227,16 +227,6 @@ sub parse { $line = substr $line, 1; } $self->{$cf} .= "\n$line"; - } elsif (m/^-----BEGIN PGP SIGNED MESSAGE-----[\r\t ]*$/) { - $expect_pgp_sig = 1; - if ($$self->{allow_pgp} and not $parabody) { - # Skip OpenPGP headers - while (<$fh>) { - last if m/^\s*$/; - } - } else { - $self->parse_error($desc, g_('OpenPGP signature not allowed here')); - } } elsif (m/^\s*$/ || ($expect_pgp_sig && m/^-----BEGIN PGP SIGNATURE-----[\r\t ]*$/)) { if ($expect_pgp_sig) { @@ -264,6 +254,16 @@ sub parse { $$self->{is_pgp_signed} = 1; } last; # Finished parsing one block + } elsif (m/^-----BEGIN PGP SIGNED MESSAGE-----[\r\t ]*$/) { + $expect_pgp_sig = 1; + if ($$self->{allow_pgp} and not $parabody) { + # Skip OpenPGP headers + while (<$fh>) { + last if m/^\s*$/; + } + } else { + $self->parse_error($desc, g_('OpenPGP signature not allowed here')); + } } else { $self->parse_error($desc, g_('line with unknown format (not field-colon-value)')); |