1 # $Id: filter_innd.pl,v 1.5 2005/04/15 14:07:11 jochen Exp $
2 # Copyright (c) 2004-2005 Jochen Striepe <t-prot@tolot.escape.de>
4 # This file is provided as an example how t-prot can be used for
5 # Perl filtering with INN2. It is NOT meant for production use.
6 # Read the README.perl_hook coming with your version of INN2, and
7 # adapt the script to your needs.
9 # Please see t-prot's man page for command line parameter details.
11 # Requirements/Bugs: mktemp(1) should be quite widely spread by
12 # now -- if it is not installed on your system, get the sources
13 # from Debian Linux or OpenBSD. Of course, rm(1) is POSIX and will
14 # be present on any reasonably Unix-like system.
15 # The script should not be run on any heavy-duty machines -- the
16 # writes to /tmp will be costly when many articles are committed
17 # at the same time. Sadly, there seems to be no really clean,
18 # portable, and standard way to realize a two-way pipe with perl.
19 # Please point me to some documentation if I am wrong. Thank you. :)
21 # License: This file is part of the t-prot package and therefore
22 # available under the same conditions. See t-prot's man page for
24 # The whole idea is robbed from Martin Dietze -- see his version at
25 # http://www.fh-wedel.de/pub/fh-wedel/staff/herbert/linux/
26 # Please note that there is no code copied from there, so the files
27 # in the t-prot package are *not* available under the terms of the
31 my $rval = "" ; # Assume we'll accept. Cannot be `0'
33 # Here we only filter local.* news groups. Another useful idea is to
34 # filter just locally submitted articles:
35 # if (index($hdr{'Path'}, '!')<0) {
36 if ($hdr{'Newsgroups'} =~ /^local\./) {
37 my $foo = $hdr{'__BODY__'};
40 # Note that here might be a security problem lurking. The directory
41 # used for temporary files should not be writable for anyone but the
42 # user INN runs as. As mentioned above, this example file is NOT
43 # meant for production use.
44 open(TMP, '/usr/bin/mktemp -q /tmp/INN2/tmp.XXXXXX | tr -d \'\n\'|')
54 open(IN, "/usr/bin/t-prot -m -t -p --body --check -i $f|")
68 sub filter_messageid {