]> git.deb.at Git - pkg/t-prot.git/blobdiff - t-prot
Imported Upstream version 1.98
[pkg/t-prot.git] / t-prot
diff --git a/t-prot b/t-prot
index 199daba5b45480da9bd5fd94ccbb04363b3a1d8d..446c0eb15c7e8151f668f69ebff319d676d16e40 100755 (executable)
--- a/t-prot
+++ b/t-prot
@@ -1,13 +1,13 @@
 #!/usr/bin/perl -w
-# $Id: t-prot,v 1.222 2005/02/14 14:19:14 jochen Exp $
+# $Id: t-prot,v 1.227 2005/03/01 15:20:49 jochen Exp $
 
 require 5.006;
 use strict;
 use Fcntl qw(O_EXCL O_WRONLY O_CREAT);
 use Getopt::Mixed qw(nextOption);
-use constant VER            => '1.96';
+use constant VER            => '1.98';
 use constant REV            => '';
-use constant REL            => q$Revision: 1.222 $=~m/(\d+(?:\.\d+)+)/;
+use constant REL            => q$Revision: 1.227 $=~m/(\d+(?:\.\d+)+)/;
 # MTA expecting mail on STDIN
 # (you might have to adjust this if using a different MTA)
 use constant SENDMAIL       => '/usr/sbin/sendmail -oi';
@@ -143,9 +143,6 @@ sub sigint_handler {
     $sigint = 1;
 }
 
-# esc(): escapes a scalar reference for use in perl regexp
-sub esc { ${$_[0]} =~ s/([\[\]\(\)\*\.\-\^\$\@])/\\$1/go; }
-
 # remove_footers(): remove any trailing appearance of footers contained
 # in the given directory.
 sub remove_footers {
@@ -310,11 +307,11 @@ sub pgp {
                my $ok = 0;
 
         while ($X<$Z) {
-            if ($$L[$X] =~ /^gpg:\s(?:$gpg_WARNING|$gpg_Warning|$gpg_bad|$gpg_Cantcheck|$gpg_expired)/o)
+            if ($$L[$X] =~ /^gpg:\s(?:\Q$gpg_WARNING\E|\Q$gpg_Warning\E|\Q$gpg_bad\E|\Q$gpg_Cantcheck\E|\Q$gpg_expired\E)/o)
                 { return 0; }
-            if ($$L[$X] =~ /^gpg:\s$gpg_bug/o)
+            if ($$L[$X] =~ /^gpg:\s\Q$gpg_bug/o)
                 { return 0; }
-            if ($$L[$X] =~ /^gpg:\s$gpg_good/o)
+            if ($$L[$X] =~ /^gpg:\s\Q$gpg_good/o)
                 { $ok = 1; }
             $X++;
         }
@@ -332,7 +329,7 @@ sub pgp {
     for (my $x=0; $x<scalar(@$L); $x++) {
         if ($$V[$x]) { next; }
 
-        if ($$L[$x]=~/^(?:\e.+?\a)?(?:$mutt_pgpoutstart)/o)
+        if ($$L[$x]=~/^(?:\e.+?\a)?(?:\Q$mutt_pgpoutstart\E)/o)
         {
             my $from;
             for (my $m=0; $m<scalar(@$H); $m++) {
@@ -344,21 +341,20 @@ sub pgp {
                 }
             }
             ($from) = $from=~m/([a-z\d][a-z_\d\+-\.]*\@(?:[a-z_\d\+-\.]+\.)+[a-z]{2,})/i;
-            esc(\$from);
 
             my $uid = 1;
 
             for (my $i=$x+1; $i<scalar(@$L); $i++) {
-                if ($pgpshort && $$L[$i] =~ /^gpg:\s$gpg_aka/o) { $uid++; }
+                if ($pgpshort && $$L[$i] =~ /^gpg:\s\Q$gpg_aka/o) { $uid++; }
 
                 if ($pgpshort && $uid>1 &&
-                    $$L[$i] =~ /^gpg:\s$gpg_aka/o && $$L[$i] !~ /$from/)
+                    $$L[$i] =~ /^gpg:\s\Q$gpg_aka/o && $$L[$i] !~ /\Q$from/)
                 { 
                     splice(@$L, $i, 1);
                     splice(@$V, $i, 1);
                     $i--;
                 }
-                elsif ($$L[$i]=~/^(?:\e.+?\a)?(?:$mutt_pgpoutend)/o)
+                elsif ($$L[$i]=~/^(?:\e.+?\a)?(?:\Q$mutt_pgpoutend\E)/o)
                 {
                     if ($pgpmove ||
                         ($pgpmovevrf && (!$sigint) && verified($L, $x+1, $i)))
@@ -374,7 +370,7 @@ sub pgp {
             }
         }
         elsif ($tmp &&
-            $$L[$x]=~/^(?:\e.+?\a)?(?:$mutt_pgpencrypted|$mutt_pgpclearsigned|$mutt_pgpsigned)/o)
+            $$L[$x]=~/^(?:\e.+?\a)?(?:\Q$mutt_pgpencrypted\E|\Q$mutt_pgpclearsigned\E|\Q$mutt_pgpsigned\E)/o)
         {
             splice(@$L, $x+1, 0, @{$tmp[$tmp]});
             for (my $i=$x; $i<scalar(@{$tmp[$tmp]}); $i++) {
@@ -546,11 +542,11 @@ sub process_msg {
             if ($vrb[$x]) { next; }
             # The following regexp's are quite ugly because for most users
             # these lines are coloured using termcap... (bah!)
-            if (($$lines[$x] =~ /^(?:\e.+?\a)?$mutt_attachment(\d+)(?::.*)? \-\-\]/o &&
+            if (($$lines[$x] =~ /^(?:\e.+?\a)?\Q$mutt_attachment\E(\d+)(?::.*)? \-\-\]/o &&
                     (($1 ne '1') ||
                     ($x<$#$lines &&
-                        $$lines[$x+1] !~ /^(?:\e.+?\a)?(?:$mutt_contenttype)(?:text\/plain|application\/pgp)/io))) ||
-                ($$lines[$x] =~ /^(?:\e.+?\a)?(?:$mutt_pgpsigned|$mutt_pgpclearsigned|$mutt_pgpencrypted)/o))
+                        $$lines[$x+1] !~ /^(?:\e.+?\a)?(?:\Q$mutt_contenttype\E)(?:text\/plain|application\/pgp)/io))) ||
+                ($$lines[$x] =~ /^(?:\e.+?\a)?(?:\Q$mutt_pgpsigned\E|\Q$mutt_pgpclearsigned\E|\Q$mutt_pgpencrypted\E)/o))
             { 
                 # Strip attachments to prepare further processing
                 unshift(@att, @$lines[$x..$#$lines]);
@@ -583,8 +579,8 @@ sub process_msg {
                 # situations.
                 # The following regexp is quite ugly because for most
                 # users the line is coloured using termcap... (bah!)
-                if ($att[$x]=~/^(?:\e.+?\a)?$mutt_attachment\d+.* --\]/o &&
-                    $att[$x+1] =~ /^(?:\e.+?\a)?(?:$mutt_contenttype)message\/rfc822/o)
+                if ($att[$x]=~/^(?:\e.+?\a)?\Q$mutt_attachment\E\d+.* --\]/o &&
+                    $att[$x+1] =~ /^(?:\e.+?\a)?(?:\Q$mutt_contenttype\E)message\/rfc822/o)
                 {
                     $x += 2;
                     while ($att[$x] !~ /^\s*$/) { $x++; }
@@ -669,16 +665,16 @@ sub process_msg {
                 if ((!$k) && $$lines[$x] !~ /^\s*$/o &&
                     ((!$mua) ||
                      ($mua eq 'mutt' &&
-                         $$lines[$x] !~ /^(?:\e.+?\a)?(?:$mutt_attachment)/o &&
-                         $$lines[$x] !~ /^(?:\e.+?\a)?(?:$mutt_contenttype)/o)) &&
-                    ((!$spass) || $$lines[$x]!~/^$spass_prefix/o))
+                         $$lines[$x] !~ /^(?:\e.+?\a)?(?:\Q$mutt_attachment\E)/o &&
+                         $$lines[$x] !~ /^(?:\e.+?\a)?(?:\Q$mutt_contenttype\E)/o)) &&
+                    ((!$spass) || $$lines[$x]!~/^\Q$spass_prefix/o))
                 {
                     if ($mua eq 'mutt' && (!$tmp) &&
-                        $$lines[$x] =~ /^(?:\e.+?\a)?(?:$mutt_pgpoutstart)/o) {
+                        $$lines[$x] =~ /^(?:\e.+?\a)?(?:\Q$mutt_pgpoutstart\E)/o) {
                         $tmp = 1; 
                     } elsif ($mua eq 'mutt' && $tmp && 
-                        ($$lines[$x] =~ /^(?:\e.+?\a)?(?:$mutt_beginsigned)/o ||
-                         $$lines[$x] =~ /^(?:\e.+?\a)?(?:$mutt_pgpclearsigstart)/o)) {
+                        ($$lines[$x] =~ /^(?:\e.+?\a)?(?:\Q$mutt_beginsigned\E)/o ||
+                         $$lines[$x] =~ /^(?:\e.+?\a)?(?:\Q$mutt_pgpclearsigstart\E)/o)) {
                         $tmp = 0;
                     } elsif (!$tmp) {
                         $k = 1;
@@ -696,7 +692,7 @@ sub process_msg {
             my $p = 0;    # levels of pgp signed parts
 
             for (my $i=$x+1; $i<scalar(@$lines); $i++) {
-                if ($$lines[$i] =~ /^(?:\e.+?\a)?(?:$mutt_pgpclearsigstart)/o) {
+                if ($$lines[$i] =~ /^(?:\e.+?\a)?(?:\Q$mutt_pgpclearsigstart\E)/o) {
                     $p++;
                 }
             }
@@ -706,7 +702,7 @@ sub process_msg {
                         splice(@att, 0, $i);
                         unshift(@att, "\n");
                         goto CLEAN;
-                    } elsif ($att[$i] =~ /^(?:\e.+?\a)?(?:$mutt_pgpclearsigned)/o) {
+                    } elsif ($att[$i] =~ /^(?:\e.+?\a)?(?:\Q$mutt_pgpclearsigned\E)/o) {
                         splice(@att, 0, $i+1);
                         $p--;
                         goto STAIRS;
@@ -973,47 +969,27 @@ if ($mua eq 'mutt') {
                 m/^([^%]*)/o;
             ($gpg_aka) =
                 Locale::gettext::gettext((' 'x16).'aka "%s"') =~
-                m/^(.*?)"/o;
+                m/^(.*?)["«%]/o;
             ($gpg_bad) =
                 Locale::gettext::gettext('BAD signature from "%s"') =~
-                m/^(.*?)"/o;
+                m/^(.*?)["«%]/o;
             ($gpg_expired) =
                 Locale::gettext::gettext("Note: This key has expired!\n") =~
                 m/^(.*?)\n/mo;
             ($gpg_good) =
                 Locale::gettext::gettext('Good signature from "%s"') =~
-                m/^(.*?)"/o;
+                m/^(.*?)["«%]/o;
             ($gpg_bug) =
                 Locale::gettext::gettext("... this is a bug (%s:%d:%s)\n") =~
                 m/^([^%]*)/o;
         }
     }
 
-    esc(\$mutt_attachment);
-    esc(\$mutt_contenttype);
-    esc(\$mutt_pgpsigned);
-    esc(\$mutt_beginsigned);
-    esc(\$mutt_pgpclearsigned);
-    esc(\$mutt_pgpclearsigstart);
-    esc(\$mutt_pgpencrypted);
-    esc(\$mutt_pgpoutstart);
-    esc(\$mutt_pgpoutend);
-
-    esc(\$gpg_WARNING);
-    esc(\$gpg_Warning);
-    esc(\$gpg_Cantcheck);
-    esc(\$gpg_aka);
-    esc(\$gpg_bad);
-    esc(\$gpg_expired);
-    esc(\$gpg_good);
-    esc(\$gpg_bug);
 }
 else {
     if ($ms_smart || $pgpshort || $pgpmove || $pgpmovevrf) { help(); }
 }
 
-esc(\$spass_prefix);
-
 
 # Read message:
 if (!open(IN, $ifile)) { print STDERR "Could not open $ifile: $!\n"; exit(EX_IOERR); }