Revision: 7452
http://sourceforge.net/p/ipcop/svn/7452
Author: owes
Date: 2014-04-11 06:08:12 +0000 (Fri, 11 Apr 2014)
Log Message:
-----------
Change TABLE automatically without need for Update button.
Add error hint for CHAIN typos, no full and detailed errortext.
Modified Paths:
--------------
ipcop/trunk/html/cgi-bin/iptablesgui.cgi
ipcop/trunk/updates/2.1.5/ROOTFILES.i486-2.1.5
Modified: ipcop/trunk/html/cgi-bin/iptablesgui.cgi
===================================================================
--- ipcop/trunk/html/cgi-bin/iptablesgui.cgi 2014-04-09 19:12:26 UTC (rev
7451)
+++ ipcop/trunk/html/cgi-bin/iptablesgui.cgi 2014-04-11 06:08:12 UTC (rev
7452)
@@ -1,30 +1,25 @@
#!/usr/bin/perl
#
-################################################################################
+# This file is part of the IPCop Firewall.
#
-# IPCop iptables Web-Iface
+# IPCop is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
#
-# Copyright (C) 2007 Olaf (weizen_42) Westrik
+# IPCop is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
-# This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option) any
later version.
+# You should have received a copy of the GNU General Public License
+# along with IPCop. If not, see <http://www.gnu.org/licenses/>.
#
-# This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+# Copyright (C) 2007 Olaf (weizen_42) Westrik
+# (c) 2008-2014, the IPCop team
#
-# You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
St, Fifth Floor, Boston, MA 02110, USA
-#
-#
-# Dieses Programm ist freie Software. Sie k\xF6nnen es unter den Bedingungen
der GNU General Public License, wie von der Free Software Foundation
ver\xF6ffentlicht, weitergeben und/oder modifizieren, entweder gem\xE4\xDF
Version 2 der Lizenz oder (nach Ihrer Option) jeder sp\xE4teren Version.
-#
-# Die Ver\xF6ffentlichung dieses Programms erfolgt in der Hoffnung, da\xDF es
Ihnen von Nutzen sein wird, aber OHNE IRGENDEINE GARANTIE, sogar ohne die
implizite Garantie der MARKTREIFE oder der VERWENDBARKEIT F\xDCR EINEN
BESTIMMTEN ZWECK. Details finden Sie in der GNU General Public License.
-#
-# Sie sollten ein Exemplar der GNU General Public License zusammen mit diesem
Programm erhalten haben. Falls nicht, schreiben Sie an die Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA.
-#
-################################################################################
-#
# $Id$
#
-# 2007-03 created by weizen_42
-#
# Add entry in menu
# MENUENTRY status 080 "IPtables" "IPTables"
@@ -34,7 +29,7 @@
use strict;
# enable only the following on debugging purpose
-use warnings;
+use warnings; no warnings 'once';
use CGI::Carp 'fatalsToBrowser';
use LWP::UserAgent;
@@ -44,8 +39,8 @@
require '/usr/lib/ipcop/header.pl';
my $option_table = '';
+my $errormessage = '';
-
my %cgiparams=();
$cgiparams{'ACTION'} = ''; # refresh
$cgiparams{'TABLE'} = 'filter'; # filter / mangle / nat / raw
@@ -60,7 +55,20 @@
&Header::openpage('IPTables', 1, '');
&Header::openbigbox('100%', 'left');
-foreach my $table ( ("filter", "mangle", "nat", "raw") ) {
+#&Header::openbox('100%', 'left', 'DEBUG');
+#foreach my $line (keys %cgiparams) {
+# print "$line = $cgiparams{$line}<br />\n";
+#}
+#print "$ENV{'QUERY_STRING'}\n";
+#&Header::closebox();
+
+
+if (($cgiparams{'TABLE'} ne 'filter') && ($cgiparams{'TABLE'} ne 'mangle') &&
($cgiparams{'TABLE'} ne 'nat') && ($cgiparams{'TABLE'} ne 'raw')) {
+ # Silently return to filter table
+ $cgiparams{'TABLE'} = 'filter';
+}
+
+foreach my $table ( ('filter', 'mangle', 'nat', 'raw') ) {
if ( $cgiparams{'TABLE'} eq $table ) {
$option_table = $option_table ."<option value='$table'
selected='selected'>$table</option>";
}
@@ -69,15 +77,28 @@
}
}
-&Header::openbox('100%', 'left', 'IPTables:');
+if ($cgiparams{'CHAIN'} !~ /^[A-Z_]*$/) {
+ $errormessage = $Lang::tr{'invalid input'};
+}
+if ($errormessage) {
+ &Header::openbox('100%', 'left', 'IPTables:', 'error');
+}
+else {
+ &Header::openbox('100%', 'left', 'IPTables:');
+}
+
print <<END
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<table width='100%'>
<tr>
- <td width='20%' class='base'>Table:</td><td colspan='3'><select
name='TABLE'>$option_table</select></td>
+ <td width='25%' class='base'>Table:</td>
+ <td colspan='3'><select name='TABLE'
onchange='this.form.submit()'>$option_table</select></td>
</tr><tr>
- <td width='20%' class='base'>Chain: <img src='/blob.gif' alt='*'
/></td><td colspan='3'><input type='text' name='CHAIN'
value='$cgiparams{'CHAIN'}' size='20' /></td>
+ <td width='25%' class='base'>Chain: <img src='/blob.gif' alt='*'
/></td>
+ <td width='25%'><input type='text' name='CHAIN'
value='$cgiparams{'CHAIN'}' size='20' /></td>
+ <td width='25%'> $errormessage</td>
+ <td width='25%'> </td>
</tr>
</table>
<hr />
@@ -95,7 +116,7 @@
;
my $output = '';
-if ($cgiparams{'CHAIN'} eq '') {
+if (($cgiparams{'CHAIN'} eq '') || $errormessage) {
$output = `/usr/local/bin/iptableswrapper $cgiparams{'TABLE'} 2>&1`;
}
else {
Modified: ipcop/trunk/updates/2.1.5/ROOTFILES.i486-2.1.5
===================================================================
--- ipcop/trunk/updates/2.1.5/ROOTFILES.i486-2.1.5 2014-04-09 19:12:26 UTC
(rev 7451)
+++ ipcop/trunk/updates/2.1.5/ROOTFILES.i486-2.1.5 2014-04-11 06:08:12 UTC
(rev 7452)
@@ -1,4 +1,5 @@
## please place IPCop files first, then packages sorted by alphabetical order
+/home/httpd/cgi-bin/iptablesgui.cgi
/usr/local/bin/upgrade.sh
/usr/local/sbin/setup
##
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Ipcop-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ipcop-svn