]> dxcluster.org Git - spider.git/commitdiff
add missing input filter for WWV
authorminima <minima>
Mon, 21 Mar 2005 22:40:45 +0000 (22:40 +0000)
committerminima <minima>
Mon, 21 Mar 2005 22:40:45 +0000 (22:40 +0000)
Changes
perl/DXCommandmode.pm
perl/DXProt.pm
perl/Geomag.pm

diff --git a/Changes b/Changes
index f332918bafac33cc825f21bae88c84b9cf8b7ad3..92d3665f6fd1b5474a4434801b1d4bbedf8a2d55 100644 (file)
--- a/Changes
+++ b/Changes
@@ -3,6 +3,8 @@
 2. merge in latest (2Mar2005) cty.dat 
 3. fix command searching so it does not pick up false positives for commands
 with / in them in directories that don't have that.
+4. Important security change.
+5. add missing input filter for WWV
 16Mar05=======================================================================
 1. make the correct correction to the DL entry in wpxloc.raw (left out the
 'N' of 'North' in the latitude).
index 332e3badc98919d3893b6f40cd0d54703d93eb4b..6b62f58a820f02d1215f7b7decd1054300ad0ec0 100644 (file)
@@ -435,6 +435,8 @@ sub run_cmd
        if ($cmd) {
                # strip out // on command only
                $cmd =~ s|//|/|g;
+               $cmd =~ s|^/||g;                # no leading / either
+               $cmd =~ s|[^-\w/]||g;           # and no funny characters either
                                        
                my ($path, $fcmd);
                        
@@ -450,7 +452,7 @@ sub run_cmd
                        
                # first expand out the entry to a command
                ($path, $fcmd) = search($main::localcmd, $cmd, "pl");
-               ($path, $fcmd) = search($main::cmd, $cmd, "pl") if !$path || !$fcmd;
+               ($path, $fcmd) = search($main::cmd, $cmd, "pl") unless $path && $fcmd;
 
                if ($path && $cmd) {
                        dbg("path: $cmd cmd: $fcmd") if isdbg('command');
@@ -918,7 +920,7 @@ sub wwv
        return unless $self->{wwv};
        
        if ($self->{wwvfilter}) {
-               ($filter, $hops) = $self->{wwvfilter}->it(@_ );
+               ($filter, $hops) = $self->{wwvfilter}->it(@_[7..$#_] );
                return unless $filter;
        }
 
index c9afde2b5593dcc3cc196d1107f88c0fdb5a7278..5bf0d1f935f367fe3dfdc110b3986706bc90a0be 100644 (file)
@@ -1234,6 +1234,16 @@ sub handle_23
                dbg("PCPROT: WWV Date ($_[1] $_[2]) out of range") if isdbg('chanerr');
                return;
        }
+
+       # global wwv filtering on INPUT
+       my @dxcc = ((Prefix::cty_data($_[6]))[0..2], (Prefix::cty_data($_[7]))[0..2]);
+       if ($self->{inwwvfilter}) {
+               my ($filter, $hops) = $self->{inwwvfilter}->it(@_[7,8], $origin, @dxcc);
+               unless ($filter) {
+                       dbg("PCPROT: Rejected by input spot filter") if isdbg('chanerr');
+                       return;
+               }
+       }
        if (Geomag::dup($d,$sfi,$k,$i,$_[6])) {
                dbg("PCPROT: Dup WWV Spot ignored\n") if isdbg('chanerr');
                return;
@@ -1839,7 +1849,7 @@ sub wwv
        my ($filter, $hops);
        
        if ($self->{wwvfilter}) {
-               ($filter, $hops) = $self->{wwvfilter}->it(@_);
+               ($filter, $hops) = $self->{wwvfilter}->it(@_[7..$#_]);
                return unless $filter;
        }
        send_prot_line($self, $filter, $hops, $isolate, $line)
index e74f50218f16f6b332a575d4d2eeba673611c67d..b1985f0541509f8dd273d8be66243127e9e58a6b 100644 (file)
@@ -49,15 +49,15 @@ $param = "$dirprefix/param";
 
 $filterdef = bless ([
                          # tag, sort, field, priv, special parser 
-                         ['by', 'c', 7],
-                         ['origin', 'c', 8],
-                         ['channel', 'c', 9],
-                         ['by_dxcc', 'nc', 10],
-                         ['by_itu', 'ni', 11],
-                         ['by_zone', 'nz', 12],
-                         ['origin_dxcc', 'nc', 13],
-                         ['origin_itu', 'ni', 14],
-                         ['origin_zone', 'nz', 15],
+                         ['by', 'c', 0],
+                         ['origin', 'c', 1],
+                         ['channel', 'c', 2],
+                         ['by_dxcc', 'nc', 3],
+                         ['by_itu', 'ni', 4],
+                         ['by_zone', 'nz', 5],
+                         ['origin_dxcc', 'nc', 6],
+                         ['origin_itu', 'ni', 7],
+                         ['origin_zone', 'nz', 8],
                         ], 'Filter::Cmd');
 
 sub init