]> git.ipfire.org Git - ipfire-2.x.git/blame - config/urlfilter/redirect_wrapper
DHCP-Client initialisiert nun die Firewall korrekt!
[ipfire-2.x.git] / config / urlfilter / redirect_wrapper
CommitLineData
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
24# Version
25my $VERSION = '1.0';
26
27use strict;
28use IPC::Open2;
29use IO::Handle;
30
31# define here your redirectors (use a comma sperated list)
32my $redirectors = [ '/usr/bin/squidGuard', '/usr/sbin/updxlrator', ];
33
34# Attention: keep in mind that the order of your redirectors is important.
35# It doesn't make sense to scan for viruses on pages you restrict access to...
36# So place first your tools which restrict access, then the tools which do the
37# content filtering!
38
39
40##### no need to change anything below this line #####
41
42# init
43$| = 1;
44STDOUT->autoflush(1);
45my $line;
46my $return;
47my $i;
48
49# open progamms
50my $pidlist = [];
51my $rlist = [];
52my $wlist = [];
53for($i = 0; $i < @$redirectors; $i++) {
54 $pidlist->[$i] = open2($rlist->[$i], $wlist->[$i], $redirectors->[$i]);
55}
56
57# wait for data...
58while($line = <>) {
59 for($i = 0; $i < @$redirectors; $i++) {
60 $wlist->[$i]->print($line);
61 $return = $rlist->[$i]->getline;
62 last if($return ne "\n" and $return ne $line);
63 # break if redirector changes data
64 }
65 print $return;
66}
67exit 0;