Hallo Matthias,

* Matthias Fechner <[EMAIL PROTECTED]> [30-12-01 00:15]:

> > Oder mit procmail und einem kleinen Skript, direkt bei der
> > Einlieferung. Kann ich Dir schicken wenn Du willst.
> 
> Das w�re super.

Ok:

-------------------------------------------------------------------
MAILFILTER_PGP=$HOME/bin/mailfilter-pgp

:0
* !^Content-Type: message/
* !^Content-Type: multipart/
* !^Content-Type: application/pgp
{
  :0 fBw
  * ^-----BEGIN PGP MESSAGE-----
  * ^-----END PGP MESSAGE-----
  | formail -i "Content-Type: application/pgp; format=text; x-action=encrypt"

  :0 fBw
  *  ^-----BEGIN PGP SIGNED MESSAGE-----
  *  ^-----BEGIN PGP SIGNATURE-----
  *  ^-----END PGP SIGNATURE-----
  | formail -i "Content-Type: application/pgp; format=text; x-action=sign"
}

:0 fBw
* ^-----BEGIN PGP PUBLIC KEY BLOCK-----
* ^-----END PGP PUBLIC KEY BLOCK-----
| formail -i "Content-Type: application/pgp-keys; format=text;"

:0
* ^Content-Type: multipart/
{
  :0 fBw
  * ^-----BEGIN PGP MESSAGE-----
  * ^-----END PGP MESSAGE-----
  | $MAILFILTER_PGP -
}
-------------------------------------------------------------------

Gruss
Janto

-- 
Linux kommt daher wie eine feste Wurst, die man im Herbst neben einem
Bl�tterhaufen direkt vor der Haust�r findet, aber wenn man einen Stock
darunterschiebt, um sie zu werfen versucht, merkt man, da� die strukturelle
Integrit�t durchaus nicht einheitlich zuverl�ssig ist.  - FvL in doc
#!/usr/bin/perl
eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
& eval 'exec perl -S $0 $argv:q'
       if 0;

($script = $0) =~ s#.*/(.*)$#$1#;
$USAGE = "
# Usage: $script mail
#
# Task: This script converts the Content-Type of attachments to
#       application/pgp ...
#       if the attachment is pgp encrypted.
#       The output will be the stdout.
#
# Version : 1.0
# Author: Daniel.Kollar\@bigfoot.de
#
";
$user=`whoami`;
$date=`date`;

die "$USAGE" if @ARGV == 0;

$header = 1;

while (<>) {
  $line = $_;

  if ( $header && $line =~ /^[\s\t]*$/ ) {
    $header = 0;
    print "$line";
    next;
  }

  if ( $header == 1 ) {   # skip header
    print "$line";
    next;
  }

  if ( !$header && $line =~ /^------.*/ ) {
    print "$line";
    $aheader = 1;
    @lines1 = ();
    $content_type = "";
    @lines = ();
    while (<>) {
      $line = $_;

      if ( $aheader && $line =~ /^Content-Type:.*/) {   # save Content-Type separately
        @lines1 = @lines;
        $content_type = $line;
        @lines = ();
        next;
      }

      if ( $aheader && $line =~ /^[\s\t]*$/ ) {   # look for header of attachment
        $aheader = 0;
        push(@lines, $line);
        next;
      }

      if ( $aheader == 1 ) {
        push(@lines, $line);
        next;
      }

      if ( !$aheader && $line =~ /^-----BEGIN PGP MESSAGE-----.*/ ) {   # attachment 
pgp encrypted
        $content_type = "Old-${content_type}Content-Type: application/pgp; 
format=text; x-action=encrypt\n";
        push (@lines, $line);
        next;
      }

      if ( !$aheader && $line =~ /^------.*/ ) {   # next attachment begins
        print join '',@lines1;
        print "$content_type";
        print join '',@lines;
        print "$line";
        $aheader = 1;
        @lines1 = ();
        $content_type = "";
        @lines = ();
        next;
      }

      push(@lines, $line);
    }
    print join '',@lines1;
    print "$content_type";
    print join '',@lines;

    last;
  }

  print "$line";

}

Attachment: msg17287/pgp00000.pgp
Description: PGP signature

Antwort per Email an