Core Update 168: Ship liburcu
[people/pmueller/ipfire-2.x.git] / html / html / clwarn.cgi
CommitLineData
0fc9925c
CS
1#!/usr/bin/perl
2###############################################################################
3# #
4# IPFire.org - A linux based firewall #
5# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
6# #
7# This program is free software: you can redistribute it and/or modify #
8# it under the terms of the GNU General Public License as published by #
9# the Free Software Foundation, either version 3 of the License, or #
10# (at your option) any later version. #
11# #
12# This program is distributed in the hope that it will be useful, #
13# but WITHOUT ANY WARRANTY; without even the implied warranty of #
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15# GNU General Public License for more details. #
16# #
17# You should have received a copy of the GNU General Public License #
18# along with this program. If not, see <http://www.gnu.org/licenses/>. #
19# #
20###############################################################################
21
22use CGI qw(param);
23
24# enable only the following on debugging purpose
25use warnings;
26use CGI::Carp 'fatalsToBrowser';
27
28$swroot="/var/ipfire";
29&readhash("$swroot/ethernet/settings", \%netsettings);
30
31my $TITLE_VIRUS = "SquidClamAv Virus detection";
32
33my $url = param('url') || '';
34my $virus = param('virus') || '';
35my $source = param('source') || '';
36$source =~ s/\/-//;
37my $user = param('user') || '';
38
39
40# Remove clamd infos
41$virus =~ s/stream: //;
42$virus =~ s/ FOUND//;
43
44print "Pragma: no-cache\n";
45print "Cache-control: no-cache\n";
46print "Connection: close\n";
47print "Content-type: text/html\n\n";
48
49print <<END
50
51<html>
52<head>
53<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
54<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
55<title>ACCESS MESSAGE</title>
56</head>
57
58<body>
59<table width="100%" height='100%' border="0">
60<tr>
61 <td colspan='3' width='100%' height='130' align="center" background="http://$netsettings{'GREEN_ADDRESS'}:81/images/background.gif">
62<tr> <td width='10%'><td align='center' bgcolor='#CC000000' width='80%'><font face="verdana, arial, sans serif" color="#FFFFFF" size="5">
63 <b>$TITLE_VIRUS</b>
64 </font>
65 <td width='10%'>
66END
67;
68
69if (!($virus eq ""))
70{
71 print <<END
72 <tr> <td colspan='3' align='center'>
73 <font face="verdana, arial, sans serif" color="#CC000000" size="1">
74 <b>$virus found</b>
75 </font>
76END
77;
78}
79print <<END
80<tr>
81 <td colspan='3' align="center">
82 <font face="verdana, arial, sans serif" color="#000000" size="4">
83 <b>Access to the requested page has been denied</b>
84 </font>
85 <font face="verdana,arial,sans serif" color="#000000" size="2">
86END
87;
88
89if (!($url eq ""))
90{
91print <<END
92 <p>URL: <a href="$url">$url</a>
93END
94;
95}
96
97if (!($source eq ""))
98{
99print <<END
100 <p>Client IP address: <i>$source</i>
101END
102;
103}
104
105print <<END
106 <br><p>Please contact the Network Administrator if you think there has been an error
107 </font>
108
109<tr>
110 <td colspan='3' height='60%' valign="bottom" align="right">
111 <font face="verdana,arial,sans serif" color="#656565" size="1">Web Filtering by
112 </font>
113 <a href="http://www.ipfire.org" target="_blank"><b>
114 <font face="verdana,arial,sans serif" color="#656565" size="1">IPFire</b></a>
115 </font>
116
117</table>
118</body>
119
120</html>
121END
122;
123
124sub readhash
125{
126 my $filename = $_[0];
127 my $hash = $_[1];
128 my ($var, $val);
129
130 if (-e $filename)
131 {
132 open(FILE, $filename) or die "Unable to read file $filename";
133 while (<FILE>)
134 {
135 chop;
136 ($var, $val) = split /=/, $_, 2;
137 if ($var)
138 {
139 $val =~ s/^\'//g;
140 $val =~ s/\'$//g;
141
142 # Untaint variables read from hash
143 $var =~ /([A-Za-z0-9_-]*)/; $var = $1;
144 $val =~ /([\w\W]*)/; $val = $1;
145 $hash->{$var} = $val;
146 }
147 }
148 close FILE;
149 }
150}