|
@@ -197,8 +197,8 @@ sub parse {
|
|
|
local $_;
|
|
local $_;
|
|
|
|
|
|
|
|
while (<$fh>) {
|
|
while (<$fh>) {
|
|
|
- s/\s*\n$//;
|
|
|
|
|
- next if length == 0 and $paraborder;
|
|
|
|
|
|
|
+ chomp;
|
|
|
|
|
+ next if m/^\s*$/ and $paraborder;
|
|
|
next if (m/^#/);
|
|
next if (m/^#/);
|
|
|
$paraborder = 0;
|
|
$paraborder = 0;
|
|
|
if (m/^(\S+?)\s*:\s*(.*)$/) {
|
|
if (m/^(\S+?)\s*:\s*(.*)$/) {
|
|
@@ -212,6 +212,7 @@ sub parse {
|
|
|
$self->parse_error($desc, g_('duplicate field %s found'), $name);
|
|
$self->parse_error($desc, g_('duplicate field %s found'), $name);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ $value =~ s/\s*$//;
|
|
|
$self->{$name} = $value;
|
|
$self->{$name} = $value;
|
|
|
$cf = $name;
|
|
$cf = $name;
|
|
|
} elsif (m/^\s(\s*\S.*)$/) {
|
|
} elsif (m/^\s(\s*\S.*)$/) {
|
|
@@ -222,8 +223,9 @@ sub parse {
|
|
|
if ($line =~ /^\.+$/) {
|
|
if ($line =~ /^\.+$/) {
|
|
|
$line = substr $line, 1;
|
|
$line = substr $line, 1;
|
|
|
}
|
|
}
|
|
|
|
|
+ $line =~ s/\s*$//;
|
|
|
$self->{$cf} .= "\n$line";
|
|
$self->{$cf} .= "\n$line";
|
|
|
- } elsif (m/^-----BEGIN PGP SIGNED MESSAGE-----$/) {
|
|
|
|
|
|
|
+ } elsif (m/^-----BEGIN PGP SIGNED MESSAGE-----[\r\t ]*$/) {
|
|
|
$expect_pgp_sig = 1;
|
|
$expect_pgp_sig = 1;
|
|
|
if ($$self->{allow_pgp} and not $parabody) {
|
|
if ($$self->{allow_pgp} and not $parabody) {
|
|
|
# Skip OpenPGP headers
|
|
# Skip OpenPGP headers
|
|
@@ -233,7 +235,8 @@ sub parse {
|
|
|
} else {
|
|
} else {
|
|
|
$self->parse_error($desc, g_('OpenPGP signature not allowed here'));
|
|
$self->parse_error($desc, g_('OpenPGP signature not allowed here'));
|
|
|
}
|
|
}
|
|
|
- } elsif (length == 0 || ($expect_pgp_sig && m/^-----BEGIN PGP SIGNATURE-----$/)) {
|
|
|
|
|
|
|
+ } elsif (m/^\s*$/ ||
|
|
|
|
|
+ ($expect_pgp_sig && m/^-----BEGIN PGP SIGNATURE-----[\r\t ]*$/)) {
|
|
|
if ($expect_pgp_sig) {
|
|
if ($expect_pgp_sig) {
|
|
|
# Skip empty lines
|
|
# Skip empty lines
|
|
|
$_ = <$fh> while defined && m/^\s*$/;
|
|
$_ = <$fh> while defined && m/^\s*$/;
|
|
@@ -241,15 +244,15 @@ sub parse {
|
|
|
$self->parse_error($desc, g_('expected OpenPGP signature, ' .
|
|
$self->parse_error($desc, g_('expected OpenPGP signature, ' .
|
|
|
'found end of file after blank line'));
|
|
'found end of file after blank line'));
|
|
|
}
|
|
}
|
|
|
- s/\s*\n$//;
|
|
|
|
|
- unless (m/^-----BEGIN PGP SIGNATURE-----$/) {
|
|
|
|
|
|
|
+ chomp;
|
|
|
|
|
+ unless (m/^-----BEGIN PGP SIGNATURE-----[\r\t ]*$/) {
|
|
|
$self->parse_error($desc, g_('expected OpenPGP signature, ' .
|
|
$self->parse_error($desc, g_('expected OpenPGP signature, ' .
|
|
|
- "found something else '%s'"), $_);
|
|
|
|
|
|
|
+ "found something else \`%s'"), $_);
|
|
|
}
|
|
}
|
|
|
# Skip OpenPGP signature
|
|
# Skip OpenPGP signature
|
|
|
while (<$fh>) {
|
|
while (<$fh>) {
|
|
|
- s/\s*\n$//;
|
|
|
|
|
- last if m/^-----END PGP SIGNATURE-----$/;
|
|
|
|
|
|
|
+ chomp;
|
|
|
|
|
+ last if m/^-----END PGP SIGNATURE-----[\r\t ]*$/;
|
|
|
}
|
|
}
|
|
|
unless (defined) {
|
|
unless (defined) {
|
|
|
$self->parse_error($desc, g_('unfinished OpenPGP signature'));
|
|
$self->parse_error($desc, g_('unfinished OpenPGP signature'));
|