From: cjwatson <> Date: Sun, 20 Oct 2002 20:21:15 +0000 (-0800) Subject: [project @ 2002-10-20 13:21:15 by cjwatson] X-Git-Tag: release/2.6.0~1024 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f4bf51775dff6370341b85ec8a1b19c3f700c32e;p=debbugs.git [project @ 2002-10-20 13:21:15 by cjwatson] Cope with old-style application/pgp clearsigned messages. --- diff --git a/scripts/errorlib.in b/scripts/errorlib.in index 0f82ab57..19a590b9 100755 --- a/scripts/errorlib.in +++ b/scripts/errorlib.in @@ -1,5 +1,5 @@ # -*- perl -*- -# $Id: errorlib.in,v 1.8 2002/10/15 23:33:37 cjwatson Exp $ +# $Id: errorlib.in,v 1.9 2002/10/20 13:21:15 cjwatson Exp $ sub F_SETLK { 6; } sub F_WRLCK{ 1; } $flockstruct= 'sslll'; # And there ought to be something for this too. @@ -155,7 +155,8 @@ sub getmailbody { my $entity = shift; my $type = $entity->effective_type; if ($type eq 'text/plain' or - ($type =~ m#text/# and $type ne 'text/html')) { + ($type =~ m#text/# and $type ne 'text/html') or + $type eq 'application/pgp') { return $entity->bodyhandle; } elsif ($type eq 'multipart/alternative') { # RFC 2046 says we should use the last part we recognize. diff --git a/scripts/process.in b/scripts/process.in index 119cd0df..5e005ce0 100755 --- a/scripts/process.in +++ b/scripts/process.in @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $Id: process.in,v 1.51 2002/10/15 23:33:37 cjwatson Exp $ +# $Id: process.in,v 1.52 2002/10/20 13:21:15 cjwatson Exp $ # # Usage: process nn # Temps: incoming/Pnn @@ -114,6 +114,19 @@ for my $hdr (@headerlines) { # remove blank lines shift @bodylines while @bodylines and $bodylines[0] !~ /\S/; +# Strip off RFC2440-style PGP clearsigning. +if (@bodylines and $bodylines[0] =~ /^-----BEGIN PGP SIGNED/) { + shift @bodylines while @bodylines and length $bodylines[0]; + shift @bodylines while @bodylines and $bodylines[0] !~ /\S/; + for my $findsig (0 .. $#bodylines) { + if ($bodylines[$findsig] =~ /^-----BEGIN PGP SIGNATURE/) { + $#bodylines = $findsig - 1; + last; + } + } + map { s/^- // } @bodylines; +} + # extract pseudo-headers for my $phline (@bodylines) { diff --git a/scripts/service.in b/scripts/service.in index 45b88cab..086395f7 100755 --- a/scripts/service.in +++ b/scripts/service.in @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $Id: service.in,v 1.56 2002/10/15 23:33:37 cjwatson Exp $ +# $Id: service.in,v 1.57 2002/10/20 13:21:15 cjwatson Exp $ # ^ more or less ^ # # Usage: service .nn @@ -84,6 +84,19 @@ for (@headerlines) { } } +# Strip off RFC2440-style PGP clearsigning. +if (@bodylines and $bodylines[0] =~ /^-----BEGIN PGP SIGNED/) { + shift @bodylines while @bodylines and length $bodylines[0]; + shift @bodylines while @bodylines and $bodylines[0] !~ /\S/; + for my $findsig (0 .. $#bodylines) { + if ($bodylines[$findsig] =~ /^-----BEGIN PGP SIGNATURE/) { + $#bodylines = $findsig - 1; + last; + } + } + map { s/^- // } @bodylines; +} + grep(s/\s+$//,@bodylines); print "***\n",join("\n",@bodylines),"\n***\n" if $debug;