[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ipcop-svn
Subject:    [Ipcop-svn] SF.net SVN: ipcop:[2739]
From:       owes () users ! sourceforge ! net
Date:       2009-04-22 20:05:56
Message-ID: E1Lwihg-0004kx-P5 () c3vjzd1 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Revision: 2739
          http://ipcop.svn.sourceforge.net/ipcop/?rev=2739&view=rev
Author:   owes
Date:     2009-04-22 20:05:56 +0000 (Wed, 22 Apr 2009)

Log Message:
-----------
In Blue Access page we try to be clever and display IP addresses and hostnames \
belonging to a MAC. This is wrong, we should simply display the settings on which we \
build our Blue Access rules.

Modified Paths:
--------------
    ipcop/trunk/html/cgi-bin/wireless.cgi

Modified: ipcop/trunk/html/cgi-bin/wireless.cgi
===================================================================
--- ipcop/trunk/html/cgi-bin/wireless.cgi	2009-04-22 18:37:31 UTC (rev 2738)
+++ ipcop/trunk/html/cgi-bin/wireless.cgi	2009-04-22 20:05:56 UTC (rev 2739)
@@ -1,9 +1,21 @@
 #!/usr/bin/perl
 #
-# IPCop CGIs
-#
-# This code is distributed under the terms of the GPL
-#
+# This file is part of the IPCop Firewall.
+# 
+# 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.
+# 
+# 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.
+# 
+# You should have received a copy of the GNU General Public License
+# along with IPCop; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+# 
 # (c) 2003 Alan Hourihane <alanh@fairlite.demon.co.uk>
 # (c) 2005 Eric Oberlander, Robert Kerr - Inline editing & DHCP leases
 #
@@ -14,22 +26,21 @@
 use Time::Local;
 
 # enable only the following on debugging purpose
-#use warnings;
-#use CGI::Carp 'fatalsToBrowser';
+use warnings; no warnings 'once';# 'redefine', 'uninitialized';
+use CGI::Carp 'fatalsToBrowser';
 
 require '/usr/lib/ipcop/general-functions.pl';
 require '/usr/lib/ipcop/lang.pl';
 require '/usr/lib/ipcop/header.pl';
 
 #workaround to suppress a warning when a variable is used only once
-my @dummy = (${Header::colouryellow});
-undef(@dummy);
+#my @dummy = (${Header::colouryellow});
+#undef(@dummy);
 
 my %cgiparams    = ();
 my %checked      = ();
 my $errormessage = '';
 my $filename     = '/var/ipcop/firewall/wireless';
-my $hostsfile    = '/var/ipcop/main/hosts';
 our %dhcpsettings = ();
 our %netsettings  = ();
 
@@ -247,16 +258,15 @@
 END
     ;
 open(FILE, "$filename");
-my @current = <FILE>;
+@current = <FILE>;
 close(FILE);
 
 print <<END
 <table width='100%'>
 <tr>
-<td align='center' width='20%'><b>$Lang::tr{'hostname'}</b></td>
 <td align='center' width='20%'><b>$Lang::tr{'source ip'}</b></td>
 <td align='center' width='20%'><b>$Lang::tr{'mac address'}</b></td>
-<td align='center' width='35%'><b>$Lang::tr{'remark'}</b></td>
+<td align='center' width='55%'><b>$Lang::tr{'remark'}</b></td>
 <td align='center' colspan='3'><b>$Lang::tr{'action'}</b></td>
 </tr>
 END
@@ -264,73 +274,29 @@
 
 my $id = 0;
 
-open(HOSTFILE, "$hostsfile");
-my @curhosts = <HOSTFILE>;
-close(HOSTFILE);
-
-my @arp = `/sbin/arp -n`;
-shift @arp;
-
 foreach my $line (@current) {
+    my $tid = ($id % 2) + 1;
     $id++;
     chomp($line);
     my $gif        = "";
     my $gdesc      = "";
-    my $hname      = "";
     my $toggle     = "";
     my @temp       = split(/\,/, $line);
     my $wirelessid = $temp[0];
     my $sourceip   = $temp[1];
     my $sourcemac  = $temp[2];
-    if ($sourceip eq 'NONE') {
 
-        foreach my $aline (@arp) {
-            chomp($aline);
-            my @atemp    = split(m{\s+}, $aline);
-            my $aipaddr  = $atemp[0];
-            my $amacaddr = lc($atemp[2]);
-            if ($amacaddr eq $sourcemac) {
-                $sourceip = $aipaddr;
-                last;
-            }
-        }
-    }
-
-    # SourceIP could now have been set by the ARP probe.
-    if ($sourceip ne 'NONE') {
-        foreach my $hline (@curhosts) {
-            chomp($hline);
-            my @htemp      = split(/\,/, $hline);
-            my $hkey       = $htemp[0];
-            my $hipaddr    = $htemp[1];
-            my $hostname   = $htemp[2];
-            my $domainname = $htemp[3];
-            if ($sourceip eq $hipaddr) {
-                $hname = "$hostname.$domainname";
-                last;
-            }
-        }
-        if ($hname eq "") {
-            my ($aliases, $addrtype, $length, @addrs);
-            ($hname, $aliases, $addrtype, $length, @addrs) = \
                gethostbyaddr(pack("C4", split(/\./, $sourceip)), 2);
-        }
-    }
-
     if   ($temp[3] eq 'on') { $gif = 'on.gif';  $toggle = 'off'; $gdesc = \
                $Lang::tr{'click to disable'}; }
     else                    { $gif = 'off.gif'; $toggle = 'on';  $gdesc = \
$Lang::tr{'click to enable'}; }  
     my $remark = $temp[4];
 
     if ($cgiparams{'ACTION'} eq 'edit' && $cgiparams{'ID'} eq $id) {
-        print "<tr bgcolor='${Header::colouryellow}'>\n";
+        print "<tr class='selectcolour'>\n";
     }
-    elsif ($id % 2) {
-        print "<tr bgcolor='${Header::table1colour}'>\n";
-    }
     else {
-        print "<tr bgcolor='${Header::table2colour}'>\n";
+        print "<tr class='table${tid}colour'>\n"; 
     }
-    print "<td align='center'>$hname</td>\n";
     print "<td align='center'>$sourceip</td>\n";
     print "<td align='center'>$sourcemac</td>\n";
     print "<td align='center'>$remark</td>\n";
@@ -432,15 +398,10 @@
     foreach my $key (sort blueleasesort keys %entries) {
 
         my $hostname = &Header::cleanhtml($entries{$key}->{HOSTNAME}, "y");
+        my $tid = ($id % 2) + 1;
 
-        if ($id % 2) {
-            print "<tr bgcolor='$Header::table2colour'>";
-        }
-        else {
-            print "<tr bgcolor='$Header::table1colour'>";
-        }
-
         print <<END
+<tr class='table${tid}colour'>
 <td align='center'>$entries{$key}->{IPADDR}</td>
 <td align='center'>$entries{$key}->{ETHER}</td>
 <td align='center'>&nbsp;$hostname </td>


This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic