]>
Commit | Line | Data |
---|---|---|
a393e0ba MT |
1 | #!/usr/bin/perl |
2 | ||
3 | ############### | |
4 | # | |
5 | # This is free software; you can redistribute it and/or modify | |
6 | # it under the terms of the GNU General Public License as published by | |
7 | # the Free Software Foundation; either version 2 of the License, or | |
8 | # (at your option) any later version. | |
9 | # | |
10 | # It is distributed in the hope that it will be useful, | |
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | # GNU General Public License for more details. | |
14 | # | |
15 | # You should have received a copy of the GNU General Public License | |
16 | # along with SquiVi2; if not, write to the Free Software | |
17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | # | |
19 | # Copyright 2004 Steffen Schoch (sschoch@users.sourceforge.net) | |
20 | # Modified by Michael Tremer for www.ipfire.org (mitch@ipfire.org, 2007) | |
21 | # | |
22 | ############### | |
23 | ||
a393e0ba MT |
24 | use strict; |
25 | use IPC::Open2; | |
26 | use IO::Handle; | |
27 | ||
28 | # define here your redirectors (use a comma sperated list) | |
29098778 | 29 | my $redirectors = [ '/usr/bin/squidGuard', '/usr/sbin/updxlrator' ]; |
a393e0ba MT |
30 | |
31 | # Attention: keep in mind that the order of your redirectors is important. | |
32 | # It doesn't make sense to scan for viruses on pages you restrict access to... | |
33 | # So place first your tools which restrict access, then the tools which do the | |
34 | # content filtering! | |
35 | ||
36 | ||
37 | ##### no need to change anything below this line ##### | |
38 | ||
39 | # init | |
40 | $| = 1; | |
41 | STDOUT->autoflush(1); | |
42 | my $line; | |
43 | my $return; | |
44 | my $i; | |
45 | ||
46 | # open progamms | |
47 | my $pidlist = []; | |
48 | my $rlist = []; | |
49 | my $wlist = []; | |
50 | for($i = 0; $i < @$redirectors; $i++) { | |
51 | $pidlist->[$i] = open2($rlist->[$i], $wlist->[$i], $redirectors->[$i]); | |
52 | } | |
53 | ||
54 | # wait for data... | |
55 | while($line = <>) { | |
56 | for($i = 0; $i < @$redirectors; $i++) { | |
57 | $wlist->[$i]->print($line); | |
58 | $return = $rlist->[$i]->getline; | |
59 | last if($return ne "\n" and $return ne $line); | |
60 | # break if redirector changes data | |
61 | } | |
62 | print $return; | |
63 | } | |
64 | exit 0; |