From be587fd8dade028c10545ffff4be13b0a18f3f91 Mon Sep 17 00:00:00 2001 From: minima Date: Mon, 21 Mar 2005 22:40:45 +0000 Subject: [PATCH] add missing input filter for WWV --- Changes | 2 ++ perl/DXCommandmode.pm | 6 ++++-- perl/DXProt.pm | 12 +++++++++++- perl/Geomag.pm | 18 +++++++++--------- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/Changes b/Changes index f332918b..92d3665f 100644 --- 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). diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index 332e3bad..6b62f58a 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -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; } diff --git a/perl/DXProt.pm b/perl/DXProt.pm index c9afde2b..5bf0d1f9 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -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) diff --git a/perl/Geomag.pm b/perl/Geomag.pm index e74f5021..b1985f05 100644 --- a/perl/Geomag.pm +++ b/perl/Geomag.pm @@ -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 -- 2.34.1