]> git.donarmstrong.com Git - debbugs.git/commitdiff
[project @ 2002-10-20 13:21:15 by cjwatson]
authorcjwatson <>
Sun, 20 Oct 2002 20:21:15 +0000 (12:21 -0800)
committercjwatson <>
Sun, 20 Oct 2002 20:21:15 +0000 (12:21 -0800)
Cope with old-style application/pgp clearsigned messages.

scripts/errorlib.in
scripts/process.in
scripts/service.in

index 0f82ab57517d3962279df17106ed4dfa74d50e32..19a590b9ca550bd072c37cf50b4c67a38b06e821 100755 (executable)
@@ -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.
index 119cd0df229f6063f040497c8602f8cb163a1255..5e005ce0a1890c0df49b310adc076239d667ea60 100755 (executable)
@@ -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)
 {
index 45b88cab657d4acd4aa73d01504893c2a8daab83..086395f7f38a94b0f22ac5bdedfe5cb15151eeb8 100755 (executable)
@@ -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 <code>.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;