- Beginn für einen proof-of-concept ohne die MIME::* tools
authorheiko
Tue, 04 Sep 2007 07:48:53 +0000
changeset 8 b6703bbc3466
parent 7 388a9b037a36
child 9 26659f592363
- Beginn für einen proof-of-concept ohne die MIME::* tools
hs12
messages/signed.in
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hs12	Tue Sep 04 07:48:53 2007 +0000
@@ -0,0 +1,102 @@
+#! /usr/bin/perl
+use strict;
+use warnings;
+
+use File::Temp qw(tempfile);
+use Smart::Comments;
+
+sub pass_mime($);
+sub forward_to_boundary($*);
+sub read_header(*);
+
+MAIN: {
+    my $message = tempfile();
+    my $out     = tempfile();
+
+    select $out or die "Can't select: $!\n";
+
+    # read the message into our tmp file
+    {
+        local $/ = \102400;
+        print {$message} <>;
+        chmod 0400, $message or die "Can't fchmod on tmpfile: $!\n";
+    }
+
+    seek($message, 0, 0);
+    my %header = read_header $message;
+
+
+BODY: {
+last BODY;
+
+        if (!$header{"mime-version"}) {
+            warn "no mime-version in header\n";
+            last BODY;
+        }
+
+        if (!$header{"content-type"}) {
+            warn "no content-type in header\n";
+            last BODY;
+        }
+
+	if (pass_mime($header{"content-type"})) {
+	    warn "passing message ($header{'content-type'})\n";
+	    last BODY;
+	}
+
+	# looks more complicated
+
+        my (undef, $boundary)
+            = ($header{"content-type"} =~ /boundary=(["'])(.*?)\1/);
+
+        if (!$boundary) {
+            warn "no boundary in content-type\n";
+            last BODY;
+        }
+
+	### boundary: $boundary
+
+	$_ = forward_to_boundary($boundary, $message);
+
+    }
+    print <$message>;    # the rest
+
+    # nun das TMP-File auch ausgeben
+    select STDOUT;
+    seek($out, 0, 0);
+    print while <$out>;
+
+}
+
+sub forward_to_boundary($*) {
+    my ($b, $fh) = @_;
+    while (<$fh>) {
+	print;
+	return if /^--$b/;
+    }
+}
+
+sub pass_mime($) {
+    return $_[0] =~ m{^text/plain};
+}
+
+sub read_header(*) {
+    my $msg = shift;
+
+    local $/ = "";
+    local $_ = <$msg>;
+
+    print;
+
+    s/\r?\n\s+/ /gm;       # FIXME: decode quoted printable
+    s/^(\S+):/\L$1:/gm;    # header fields to lower case
+
+    return (":UNIX_FROM:" => split(/^(\S+):\s*/m, $_) );
+
+}
+__END__
+
+my $parser = new MIME::Parser;
+
+# read the complete mail
+my $entity = $parser->parse(\*STDIN);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messages/signed.in	Tue Sep 04 07:48:53 2007 +0000
@@ -0,0 +1,132 @@
+From bounce-debian-user-german=hs=schlittermann.de@lists.debian.org Mon Sep 03 17:38:53 2007
+Received: from uucp by jumper.schlittermann.de with local-rmail (Exim 4.63)
+	(envelope-from <bounce-debian-user-german=hs=schlittermann.de@lists.debian.org>)
+	id 1ISE0r-0004Ok-KE
+	for heiko@jumper.schlittermann.de; Mon, 03 Sep 2007 17:38:53 +0200
+Received: from cyrus by ssl.schlittermann.de with local (Exim 4.63)
+	(envelope-from <bounce-debian-user-german=hs=schlittermann.de@lists.debian.org>)
+	id 1ISDwP-00023b-Io
+	for heiko@jumper.schlittermann.de; Mon, 03 Sep 2007 17:34:17 +0200
+Received: from ssl.schlittermann.de ([unix socket])
+	 by pu (Cyrus v2.2.13-Debian-2.2.13-0.4.ius.stable) with LMTPA;
+	 Mon, 03 Sep 2007 17:34:17 +0200
+X-Sieve: CMU Sieve 2.2
+Received: from scanner.schlittermann.de ([212.80.235.140])
+	by ssl.schlittermann.de with esmtp (Exim 4.63)
+	(envelope-from <bounce-debian-user-german=hs=schlittermann.de@lists.debian.org>)
+	id 1ISDwP-00023T-9h
+	for hs@schlittermann.de; Mon, 03 Sep 2007 17:34:17 +0200
+X-Virus-Scanned: Debian amavisd-new at scanner.schlittermann.de
+Received: from ssl.schlittermann.de ([212.80.235.130])
+	by scanner.schlittermann.de (scanner.schlittermann.de [212.80.235.140]) (amavisd-new, port 10024)
+	with ESMTP id etEIcw56mc1b for <hs@schlittermann.de>;
+	Mon,  3 Sep 2007 17:34:16 +0200 (CEST)
+Received: from murphy.debian.org ([70.103.162.31])
+	by ssl.schlittermann.de with esmtp (Exim 4.63)
+	(envelope-from <bounce-debian-user-german=hs=schlittermann.de@lists.debian.org>)
+	id 1ISDwH-000227-6R
+	for hs@schlittermann.de; Mon, 03 Sep 2007 17:34:13 +0200
+Received: from localhost (localhost [127.0.0.1])
+	by murphy.debian.org (Postfix) with QMQP
+	id 2BA702E7A4; Mon,  3 Sep 2007 15:40:29 +0000 (UTC)
+Old-Return-Path: <uwe.kerstan@gmx.de>
+X-Spam-Checker-Version: SpamAssassin 3.1.4 (2006-07-26) on murphy.debian.org
+X-Spam-Status: No, score=-7.3 required=4.0 tests=AWL,BAYES_00,LDOSUBSCRIBER,
+	SPF_PASS autolearn=ham version=3.1.4
+X-Original-To: debian-user-german@lists.debian.org
+Received: from mail.gmx.net (mail.gmx.net [213.165.64.20])
+	by murphy.debian.org (Postfix) with SMTP id 8AA922E6E9
+	for <debian-user-german@lists.debian.org>; Mon,  3 Sep 2007 15:40:21 +0000 (UTC)
+Received: (qmail invoked by alias); 03 Sep 2007 15:33:43 -0000
+Received: from pD95D3374.dip0.t-ipconnect.de (EHLO kiste.home.zz) [217.93.51.116]
+  by mail.gmx.net (mp036) with SMTP; 03 Sep 2007 17:33:43 +0200
+X-Authenticated: #636122
+X-Provags-ID: V01U2FsdGVkX1+EVgAKYkaEHifj89tKEtKSvw8bFiMfD1wz7Sl+VW
+	Bjno2WJ62Zdjmi
+Received: from uk by kiste.home.zz with local (Exim 4.63)
+	(envelope-from <uwe.kerstan@gmx.de>)
+	id 1ISDvr-0001tq-BJ
+	for debian-user-german@lists.debian.org; Mon, 03 Sep 2007 17:33:43 +0200
+Date: Mon, 3 Sep 2007 17:33:43 +0200
+From: Uwe Kerstan <uwe.kerstan@gmx.de>
+To: debian-user-german@lists.debian.org
+Message-ID: <20070903153343.GA5367@kiste.home.zz>
+Mail-Followup-To: debian-user-german@lists.debian.org
+References: <8Z2Q8-5sF-15@gated-at.bofh.it> <8Z67m-2hf-13@gated-at.bofh.it> <8ZhP5-3BY-15@gated-at.bofh.it> <8ZjHe-6F4-3@gated-at.bofh.it> <0MKxQS-1ISC0q3VR5-000887@mrelayeu.kundenserver.de>
+MIME-Version: 1.0
+Content-Type: multipart/signed; micalg=pgp-sha1;
+	protocol="application/pgp-signature"; boundary="Q68bSM7Ycu6FN28Q"
+Content-Disposition: inline
+In-Reply-To: <0MKxQS-1ISC0q3VR5-000887@mrelayeu.kundenserver.de>
+X-Priority: normal
+Organization: CoLUG
+X-Face: )M4WRmNYmN{3M5vXo_nkM-A3^OAc,/Hr_@z~#Y[$%&ju~oLC)p`Lp5E*~y]D=|BKd_ACwSi
+ L*"9GpEg<D>RUAPbGg3Sbcy%'4tzZkb[<ZWW;6Ae;#?}|;;.8OHNU8QO$
+X-URL: http://www.linuxer.onlinehome.de 
+Mail-Copies-To: nobody
+User-Agent: Mutt/1.5.13 (2006-08-11)
+X-Y-GMX-Trusted: 0
+X-Rc-Virus: 2006-10-25_01
+X-Rc-Spam: 2007-05-24_01
+Resent-Message-ID: <-vOUfC.A.nwE.trC3GB@murphy>
+Resent-From: debian-user-german@lists.debian.org
+X-Mailing-List: <debian-user-german@lists.debian.org> archive/latest/215987
+X-Loop: debian-user-german@lists.debian.org
+List-Id: <debian-user-german.lists.debian.org>
+List-Post: <mailto:debian-user-german@lists.debian.org>
+List-Help: <mailto:debian-user-german-request@lists.debian.org?subject=help>
+List-Subscribe: <mailto:debian-user-german-request@lists.debian.org?subject=subscribe>
+List-Unsubscribe: <mailto:debian-user-german-request@lists.debian.org?subject=unsubscribe>
+Precedence: list
+Resent-Sender: debian-user-german-request@lists.debian.org
+Resent-Date: Mon,  3 Sep 2007 15:40:29 +0000 (UTC)
+X-IUS-Spam-Comment: scanned on ssl.schlittermann.de hash:35FCFDF61F49A167A89EABD0CC15386592069464
+X-IUS-Spam-Score: -2.4
+X-IUS-Spam-Level: --
+X-IUS-Spam-Report: AWL=0.155,BAYES_00=-2.599
+Subject: Re: ZDF Mediathek funktioniert nicht im Firefox u.a. Browsern
+
+--Q68bSM7Ycu6FN28Q
+Content-Type: text/plain; charset=iso-8859-1
+Content-Disposition: inline
+Content-Transfer-Encoding: quoted-printable
+
+* A.net.te_und_Mi.cha.el_Glo.cken.stein  [03-09-2007 15:30]:
+
+> Da scheint es aber ein Problem mit JavaScript zu sein, ich bekomme
+> nur einen grauen Hintergrund, nicht mal eine Auswahl von Optionen
+> oder Filmen. Bin lieber mit dem Konqueror unterwegs, schade.
+
+Der Javascript scheint ein paar Macken zu haben. Bei mir geht es
+mit vlc-plugin und mplayer-plugin. vlc-plugin hat leider keine
+Steuerelemente, mplayer-plugin hat etwas geruckelt, da kann man
+an den Cache-Optionen drehen, dann wird es besser. Wenn man
+zu einem anderen Film wechselt, st=FCrzt der Iceweasel manchmal ab.
+Alternative Links auf die Videos w=E4ren w=FCnschenswert...
+
+Gru=DF Uwe
+
+--Q68bSM7Ycu6FN28Q
+Content-Type: application/pgp-signature; name="signature.asc"
+Content-Description: Digital signature
+Content-Disposition: inline
+
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.6 (GNU/Linux)
+
+iD8DBQFG3ClXtReBfnaTvyIRAsmZAKCHsUGjg07DYXS8x+HbnVjTlOTrKwCcD1Lx
+OFqTZ8TAcGvQfRwLsgTAEF0=
+=kwDw
+-----END PGP SIGNATURE-----
+
+--Q68bSM7Ycu6FN28Q--
+
+
+-- 
+Haeufig gestellte Fragen und Antworten (FAQ): 
+http://www.de.debian.org/debian-user-german-FAQ/
+
+Zum AUSTRAGEN schicken Sie eine Mail an debian-user-german-REQUEST@lists.debian.org
+mit dem Subject "unsubscribe". Probleme? Mail an listmaster@lists.debian.org (engl)
+
+