+2006-06-17 22:45 Jochen Striepe
+
+ * t-prot: Release as v2.1.
+
+2006-06-17 22:45 Jochen Striepe
+
+ * t-prot: Frank Terbeck suggested a more tolerant handling of
+ signatures -- trailing newlines are no longer counted as signature
+ lines, thus fixing some mailing list software behaviour.
+
+2006-06-17 12:34 Jochen Striepe
+
+ * t-prot.1: Update time stamp.
+
+2006-06-17 12:34 Jochen Striepe
+
+ * t-prot.1: Section "BUGS" is for known bugs in t-prot, not for
+ learning how to report them.
+
+2006-05-16 12:07 Jochen Striepe
+
+ * t-prot: Klaus Ethgen reported some undetected MS TOFU hidden in
+ MIME attachments. Many thanks!
+
+2006-05-16 12:07 Jochen Striepe
+
+ * t-prot.1: There is no BUGS file any longer.
+
+2006-05-16 11:34 Jochen Striepe
+
+ * t-prot.1: Time stamp and copyright updated.
+
+2006-05-16 11:33 Jochen Striepe
+
+ * contrib/t-prot.sl: Clarify comments reg. S-Lang v2.
+
2005-06-29 12:45 Jochen Striepe
* t-prot.1: Better formatting for "see also".
Please remember that t-prot.sl is an *example* script (for you to get
an idea on how to integrate t-prot into other software), so these are
really low priority. However, patches in unified diff format are always
-welcome. ;)
+welcome.
smoothly. Please send a bug report if there are some great new
features in the new mutt or gnupg which break anything inside t-prot.
+t-prot.sl-slang2.diff
+=====================
+Patch by Gregor Herrmann, making t-prot.sl run with Slang-2.
+
+
Please note that these patches will most likely be applied by the t-prot
package maintainer(s) of your distribution (if the distribution makes
use of said mutt and gnupg versions).
+
OBSOLETE PATCHES
================
+++ /dev/null
---- t-prot 2005-08-16 16:20:08.000000000 +0200
-+++ t-prot-M157 2005-09-06 14:41:37.000000000 +0200
-@@ -32,7 +32,7 @@
-
- $mutt_attachment $mutt_contenttype $mutt_pgpsigned $mutt_beginsigned
- $mutt_pgpclearsigned $mutt_pgpclearsigstart $mutt_pgpencrypted
-- $mutt_pgpoutstart $mutt_pgpoutend
-+ $mutt_pgpoutstart $mutt_pgpoutend $mutt_ssloutstart $mutt_ssloutend
- );
-
-
-@@ -69,6 +69,8 @@
- $mutt_pgpencrypted = '[-- End of PGP/MIME encrypted data --]';
- $mutt_pgpoutstart = '[-- PGP output follows (current time:';
- $mutt_pgpoutend = '[-- End of PGP output --]';
-+$mutt_ssloutstart = '[-- OpenSSL output follows';
-+$mutt_ssloutend = '[-- End of OpenSSL output --]';
-
- # set the defaults to the C locale
- $gpg_WARNING = 'WARNING: ';
-@@ -336,7 +338,7 @@
- for (my $x=0; $x<scalar(@$L); $x++) {
- if ($$V[$x]) { next; }
-
-- if ($$L[$x]=~/^(?:\e[^\a]+\a)?(?:\Q$mutt_pgpoutstart\E)/o)
-+ if ($$L[$x]=~/^(?:\e[^\a]+\a)?(?:\Q$mutt_pgpoutstart\E|\Q$mutt_ssloutstart\E)/o)
- {
- my $from;
- for (my $m=0; $m<scalar(@$H); $m++) {
-@@ -363,7 +365,7 @@
- splice(@$V, $i, 1);
- $i--;
- }
-- elsif ($$L[$i]=~/^(?:\e[^\a]+\a)?(?:\Q$mutt_pgpoutend\E)/o)
-+ elsif ($$L[$i]=~/^(?:\e[^\a]+\a)?(?:\Q$mutt_pgpoutend\E|\Q$mutt_ssloutend\E)/o)
- {
- if ($pgpmove ||
- ($pgpmovevrf && (!$sigint) && verified($L, $x+1, $i)))
-@@ -685,7 +687,7 @@
- 'Forwarded message',
- 'Weitergeleitete Nachricht / Forwarded Message');
- my $k = 0; # any text above?
-- my $tmp = 0; # flagged if inside PGP output
-+ my $tmp = 0; # flagged if inside PGP or SSL output
-
- DONE: for ($x=0; $x<scalar(@$lines); $x++) {
- if (!$vrb[$x]) {
-@@ -708,9 +710,11 @@
- ((!$spass) || index($$lines[$x], $spass_prefix)!=0))
- {
- if ($mua eq 'mutt' && (!$tmp) &&
-- $$lines[$x] =~
-- /^(?:\e[^\a]+\a)?(?:\Q$mutt_pgpoutstart\E)/o) {
-- $tmp = 1;
-+ ($$lines[$x] =~
-+ /^(?:\e[^\a]+\a)?(?:\Q$mutt_pgpoutstart\E)/o ||
-+ $$lines[$x] !~
-+ /^(?:\e[^\a]+\a)?(?:\Q$mutt_ssloutstart\E)/o)) {
-+ $tmp = 1;
- } elsif ($mua eq 'mutt' && $tmp &&
- ($$lines[$x] =~
- /^(?:\e[^\a]+\a)?(?:\Q$mutt_beginsigned\E)/o ||
-@@ -981,8 +985,8 @@
- Locale::gettext::gettext("[-- Type: %s/%s, Encoding: %s, Size: %s --]\n") =~
- m/^([^%]*)/;
- ($mutt_pgpsigned) =
-- Locale::gettext::gettext("[-- End of signed data --]\n") =~
-- m/^(.*)\n/m;
-+ Locale::gettext::gettext("\n[-- End of signed data --]\n") =~
-+ m/^\n*(.*)\n/m;
- ($mutt_beginsigned) =
- Locale::gettext::gettext("[-- The following data is signed --]\n\n") =~
- m/^(.*)\n/m;
-@@ -990,16 +994,24 @@
- Locale::gettext::gettext("[-- END PGP SIGNED MESSAGE --]\n") =~
- m/^(.*)\n/m;
- ($mutt_pgpclearsigstart) =
-- Locale::gettext::gettext("[-- BEGIN PGP SIGNED MESSAGE --]\n") =~
-+ Locale::gettext::gettext("[-- BEGIN PGP SIGNED MESSAGE --]\n\n") =~
- m/^(.*)\n/m;
- ($mutt_pgpencrypted) =
- Locale::gettext::gettext("[-- End of PGP/MIME encrypted data --]\n") =~
- m/^(.*)\n/m;
- ($mutt_pgpoutstart) =
-- Locale::gettext::gettext("[-- PGP output follows (current time: %c) --]\n") =~
-- m/^([^%]*)/;
-+ Locale::gettext::gettext("[-- %s output follows%s --]\n") =~
-+ m/^(.*)%s/;
-+ $mutt_pgpoutstart =~ s/%s/PGP/;
- ($mutt_pgpoutend) =
-- Locale::gettext::gettext("[-- End of PGP output --]\n") =~
-+ Locale::gettext::gettext("[-- End of PGP output --]\n\n") =~
-+ m/^(.*)\n/m;
-+ ($mutt_ssloutstart) =
-+ Locale::gettext::gettext("[-- %s output follows%s --]\n") =~
-+ m/^(.*)%s/;
-+ $mutt_ssloutstart =~ s/%s/OpenSSL/;
-+ ($mutt_ssloutend) =
-+ Locale::gettext::gettext("[-- End of OpenSSL output --]\n\n") =~
- m/^(.*)\n/m;
-
- Locale::gettext::textdomain('gnupg');
--- /dev/null
+--- t-prot 2006-05-16 14:07:58.000000000 +0200
++++ t-prot-M157 2006-05-22 18:25:04.000000000 +0200
+@@ -32,7 +32,7 @@
+
+ $mutt_attachment $mutt_contenttype $mutt_pgpsigned $mutt_beginsigned
+ $mutt_pgpclearsigned $mutt_pgpclearsigstart $mutt_pgpencrypted
+- $mutt_pgpoutstart $mutt_pgpoutend
++ $mutt_pgpoutstart $mutt_pgpoutend $mutt_ssloutstart $mutt_ssloutend
+ );
+
+
+@@ -69,6 +69,8 @@
+ $mutt_pgpencrypted = '[-- End of PGP/MIME encrypted data --]';
+ $mutt_pgpoutstart = '[-- PGP output follows (current time:';
+ $mutt_pgpoutend = '[-- End of PGP output --]';
++$mutt_ssloutstart = '[-- OpenSSL output follows';
++$mutt_ssloutend = '[-- End of OpenSSL output --]';
+
+ # set the defaults to the C locale
+ $gpg_WARNING = 'WARNING: ';
+@@ -336,7 +338,7 @@
+ for (my $x=0; $x<scalar(@$L); $x++) {
+ if ($$V[$x]) { next; }
+
+- if ($$L[$x]=~/^(?:\e[^\a]+\a)?(?:\Q$mutt_pgpoutstart\E)/o)
++ if ($$L[$x]=~/^(?:\e[^\a]+\a)?(?:\Q$mutt_pgpoutstart\E|\Q$mutt_ssloutstart\E)/o)
+ {
+ my $from;
+ for (my $m=0; $m<scalar(@$H); $m++) {
+@@ -363,7 +365,7 @@
+ splice(@$V, $i, 1);
+ $i--;
+ }
+- elsif ($$L[$i]=~/^(?:\e[^\a]+\a)?(?:\Q$mutt_pgpoutend\E)/o)
++ elsif ($$L[$i]=~/^(?:\e[^\a]+\a)?(?:\Q$mutt_pgpoutend\E|\Q$mutt_ssloutend\E)/o)
+ {
+ if ($pgpmove ||
+ ($pgpmovevrf && (!$sigint) && verified($L, $x+1, $i)))
+@@ -685,7 +687,7 @@
+ 'Forwarded message',
+ 'Weitergeleitete Nachricht / Forwarded Message');
+ my $k = 0; # any text above?
+- my $tmp = 0; # flagged if inside PGP output
++ my $tmp = 0; # flagged if inside PGP or SSL output
+
+ DONE: for ($x=0; $x<scalar(@$lines); $x++) {
+ if (!$vrb[$x]) {
+@@ -708,9 +710,11 @@
+ ((!$spass) || index($$lines[$x], $spass_prefix)!=0))
+ {
+ if ($mua eq 'mutt' && (!$tmp) &&
+- $$lines[$x] =~
+- /^(?:\e[^\a]+\a)?(?:\Q$mutt_pgpoutstart\E)/o) {
+- $tmp = 1;
++ ($$lines[$x] =~
++ /^(?:\e[^\a]+\a)?(?:\Q$mutt_pgpoutstart\E)/o ||
++ $$lines[$x] =~
++ /^(?:\e[^\a]+\a)?(?:\Q$mutt_ssloutstart\E)/o)) {
++ $tmp = 1;
+ } elsif ($mua eq 'mutt' && $tmp &&
+ ($$lines[$x] =~
+ /^(?:\e[^\a]+\a)?(?:\Q$mutt_beginsigned\E)/o ||
+@@ -981,8 +985,8 @@
+ Locale::gettext::gettext("[-- Type: %s/%s, Encoding: %s, Size: %s --]\n") =~
+ m/^([^%]*)/;
+ ($mutt_pgpsigned) =
+- Locale::gettext::gettext("[-- End of signed data --]\n") =~
+- m/^(.*)\n/m;
++ Locale::gettext::gettext("\n[-- End of signed data --]\n") =~
++ m/^\n*(.*)\n/m;
+ ($mutt_beginsigned) =
+ Locale::gettext::gettext("[-- The following data is signed --]\n\n") =~
+ m/^(.*)\n/m;
+@@ -990,16 +994,24 @@
+ Locale::gettext::gettext("[-- END PGP SIGNED MESSAGE --]\n") =~
+ m/^(.*)\n/m;
+ ($mutt_pgpclearsigstart) =
+- Locale::gettext::gettext("[-- BEGIN PGP SIGNED MESSAGE --]\n") =~
++ Locale::gettext::gettext("[-- BEGIN PGP SIGNED MESSAGE --]\n\n") =~
+ m/^(.*)\n/m;
+ ($mutt_pgpencrypted) =
+ Locale::gettext::gettext("[-- End of PGP/MIME encrypted data --]\n") =~
+ m/^(.*)\n/m;
+ ($mutt_pgpoutstart) =
+- Locale::gettext::gettext("[-- PGP output follows (current time: %c) --]\n") =~
+- m/^([^%]*)/;
++ Locale::gettext::gettext("[-- %s output follows%s --]\n") =~
++ m/^(.*)%s/;
++ $mutt_pgpoutstart =~ s/%s/PGP/;
+ ($mutt_pgpoutend) =
+- Locale::gettext::gettext("[-- End of PGP output --]\n") =~
++ Locale::gettext::gettext("[-- End of PGP output --]\n\n") =~
++ m/^(.*)\n/m;
++ ($mutt_ssloutstart) =
++ Locale::gettext::gettext("[-- %s output follows%s --]\n") =~
++ m/^(.*)%s/;
++ $mutt_ssloutstart =~ s/%s/OpenSSL/;
++ ($mutt_ssloutend) =
++ Locale::gettext::gettext("[-- End of OpenSSL output --]\n\n") =~
+ m/^(.*)\n/m;
+
+ Locale::gettext::textdomain('gnupg');
-% $Id: t-prot.sl,v 1.16 2005/05/10 13:09:06 jochen Exp $
+% $Id: t-prot.sl,v 1.17 2006/05/16 11:33:32 jochen Exp $
% Copyright (c) 2003-2005 Jochen Striepe <t-prot@tolot.escape.de>
%
% This file is provided as an example implemention for articles to be
% OpenBSD or Debian Linux system -- you can get the sources there
% if your system happens to lack this program. This macro has been
% tested with slrn-0.9.7.4 to slrn-0.9.8.0 and S-Lang v1.4.5, it might
-% fail with other versions. As always, bug reports, patches (preferrably
-% in unified diff format), comments and suggestions are welcome.
+% fail with other versions (and will definitely fail with S-Lang v2.x).
+% As always, bug reports, patches (preferrably in unified diff format),
+% comments and suggestions are welcome.
%
% License: This file is part of the t-prot package and therefore
% available under the same conditions. See t-prot's man page for
--- /dev/null
+Patch 2005-12-23 by Gregor Herrmann, making t-prot.sl run with slang2.
+His comment:
+
+| After some fiddling around and reading manuals I found a workaround:
+| replace "error" by "message".
+| I don't know if this is the canonical solution but at least the
+| errors are gone :-)
+
+
+--- t-prot.sl.2.0.2-1 2005-12-23 19:20:43.000000000 +0100
++++ t-prot.sl 2005-12-23 19:21:24.000000000 +0100
+@@ -73,3 +73,3 @@
+ if (f == NULL) {
+- error ("Unable to filter article to "+fname);
++ message ("Unable to filter article to "+fname);
+ return;
+@@ -82,3 +82,3 @@
+ if (f == NULL) {
+- error (fname+" could not be opened.");
++ message (fname+" could not be opened.");
+ return;
+@@ -90,3 +90,3 @@
+
+- if (0 != remove(fname)) error ("Unable to remove "+fname);
++ if (0 != remove(fname)) message ("Unable to remove "+fname);
+
+@@ -97,6 +97,6 @@
+ if (1 == register_hook("read_article_hook", "t_prot")) {
+- error("t-prot filtering activated");
++ message ("t-prot filtering activated");
+ }
+ else {
+- error("t-prot filtering NOT activated");
++ message ("t-prot filtering NOT activated");
+ }
+@@ -106,6 +106,6 @@
+ if (1 == unregister_hook("read_article_hook", "t_prot")) {
+- error("t-prot filtering deactivated");
++ message ("t-prot filtering deactivated");
+ }
+ else {
+- error("t-prot filtering NOT deactivated");
++ message ("t-prot filtering NOT deactivated");
+ }
#!/usr/bin/perl -w
-# $Id: t-prot,v 1.243 2005/05/27 10:00:35 jochen Exp $
+# $Id: t-prot,v 1.246 2006/06/17 22:45:55 jochen Exp $
require 5.006;
use strict;
use Fcntl qw(O_EXCL O_WRONLY O_CREAT);
use Getopt::Mixed qw(nextOption);
-use constant VER => '2.0';
+use constant VER => '2.1';
use constant REV => '';
-use constant REL => q$Revision: 1.243 $=~m/(\d+(?:\.\d+)+)/;
+use constant REL => q$Revision: 1.246 $=~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';
/^(?:\e[^\a]+\a)?\Q$mutt_attachment\E\d+/o &&
$att[$x+1] =~ m!^
(?:\e[^\a]+\a)?
- (?:\Q$mutt_contenttype\E) message/rfc822
+ (?:\Q$mutt_contenttype\E) (?:message/rfc822|multipart/alternative)
!ox)
{
$x += 2;
# Remove signature:
if (scalar(@$lines)) {
my $sn = 0;
+ my $chk_empty = 1;
+ my $empty = 0;
+
for ($x = $#$lines; $x>=0; $x--) {
- if ((!$vrb[$x]) && $$lines[$x] =~ /^-- $/) {
- if ($diff) {
- for (my $i=1; $x+$i+1<scalar(@$lines); $i++) {
- if ($$lines[$x+$i] =~ /^-{3}\s+\S/ &&
- $$lines[$x+$i+1] =~ /^\+{3}\s+\S/)
- {
- $sig = 0;
- unshift(@sig, @$lines[$x..$#$lines]);
- splice(@$lines, $x);
- last;
+ if (!$vrb[$x]) {
+ if ($$lines[$x] =~ /^-- $/) {
+ if ($diff) {
+ for (my $i=1; $x+$i+1<scalar(@$lines); $i++) {
+ if ($$lines[$x+$i] =~ /^-{3}\s+\S/ &&
+ $$lines[$x+$i+1] =~ /^\+{3}\s+\S/)
+ {
+ $sig = 0;
+ unshift(@sig, @$lines[$x..$#$lines]);
+ splice(@$lines, $x);
+ last;
+ }
+ }
+ if (scalar(@sig)) {
+ if (defined($sign) && ++$sn==$sign) { last; } else { next; }
}
}
- if (scalar(@sig)) {
- if (defined($sign) && ++$sn==$sign) { last; } else { next; }
- }
- }
- if ($sig || ($lsig && ($#$lines-$x>$lsig))) {
- if ($lsig && !$sig) {
- unshift(@sig, "[---=| Overlong signature removed by $0: " .
- (scalar(@$lines)-$x) . " lines snipped |=---]\n");
+ if ($sig || ($lsig && ($#$lines-$x-$empty>$lsig))) {
+ if ($lsig && !$sig) {
+ unshift(@sig, "[---=| Overlong signature removed by $0: " .
+ (scalar(@$lines)-$x) . " lines snipped |=---]\n");
+ }
+ splice(@$lines, $x);
}
- splice(@$lines, $x);
- }
- else {
- unshift(@sig, @$lines[$x..$#$lines]);
- splice(@$lines, $x);
+ else {
+ unshift(@sig, @$lines[$x..$#$lines]);
+ splice(@$lines, $x);
+ }
+ if (defined($sign) && ++$sn==$sign) { last; } else { next; }
}
- if (defined($sign) && ++$sn==$sign) { last; } else { next; }
+ # any trailing newlines?
+ elsif ($chk_empty && $$lines[$x] =~ /^\s*$/) { $empty++; }
+ elsif ($chk_empty) { $chk_empty = 0; }
}
}
}
-.\" $Id: t-prot.1,v 1.117 2005/06/29 12:45:55 jochen Exp $
+.\" $Id: t-prot.1,v 1.121 2006/06/17 12:34:54 jochen Exp $
.\"
-.TH T-PROT "1" "June 2005" "T-PROT"
+.TH T-PROT "1" "June 2006" "T-PROT"
.SH NAME
t-prot \- TOFU Protection - Display Filter for RFC 2822 messages
.SH SYNOPSIS
.IR NOTE :
This option is considered stable by now. However, sometimes Kammquotes
should have been removed but weren't. Please send a bug report if this
-happens to you (after carefully reading the BUGS file, that is).
+happens to you (after carefully reading the BUGS and REPORTING BUGS
+section of this man page, that is).
.IP
Please also note that enabling this option is quite a performance hit.
.TP
All of the documentation and software included in the t-prot releases
is copyrighted by Jochen Striepe.
.PP
-Copyright \(co 2001-2005 Jochen Striepe. All rights reserved.
+Copyright \(co 2001-2006 Jochen Striepe. All rights reserved.
.PP
Redistribution and use, with or without modification, are permitted
provided that the following conditions are met:
You can get the latest version from
.IR http://www.escape.de/users/tolot/mutt/ .
.SH BUGS
+There is a problem when mutt gives a PGP verified or even a multipart
+message to t-prot: The information where the PGP encrypted/signed data
+or even attachments begin and end is plainly embedded in the text, not
+really cleanly recognizeable for t-prot. The problem should be worked
+around by now, please send a bug report if it does not work for you.
+.SH "REPORTING BUGS"
Please note that t-prot development happens on
.BR "current stable perl versions only" .
If you do run t-prot on earlier (or unstable) perl versions, you might
encounter perl compiler bugs (or funny t-prot behaviour). One solution
is to upgrade your perl, another is simply to write a bug report. If
you do not run a current perl version, please include this information
-in your bug report. Thank you.
+in your bug report.
.PP
-There is a problem when mutt gives a PGP verified or even a multipart
-message to t-prot: The information where the PGP encrypted/signed data
-or even attachments begin and end is plainly embedded in the text, not
-really cleanly recognizeable for t-prot. The problem should be worked
-around by now, please send a bug report if it does not work for you.
-.SH "REPORTING BUGS"
Please do
.I not
report a bug if