From 42846321acd959aa93c2c2afd2b1f0a67f8accaf Mon Sep 17 00:00:00 2001 From: minima Date: Sun, 4 Nov 2001 17:31:38 +0000 Subject: [PATCH] fix the send command so that only valid TO addresses are allowed. --- Changes | 6 ++++++ cmd/send.pl | 17 ++++++++++++----- perl/DXMsg.pm | 26 ++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/Changes b/Changes index 0140f812..1580cbca 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,12 @@ 1. Allow the user to equal the node in RSPF checks (this allows spots and stuff with the origin and spotter to be the same (although it is STRONGLY recommended that they are NOT!!! [hint hint]). +2. make the send command rather more sensitive to what is allowed. Basically +it will only allow TO addresses that are bull addresses (if not private) or +vaild callsigns (if private). Bull addresses are the ones in +/spider/msg/forward.pl with a 'T' flag on them. If there is no forward +file it will only allow 'ALL' and 'DX' as valid Bull TO addresses. You may +use commas as callsign separators if you like. 02Nov01======================================================================= 1. fixed some Aliasing problems, but this whole area will have to be addressed more comprehensively. diff --git a/cmd/send.pl b/cmd/send.pl index 9cee7915..b728d387 100644 --- a/cmd/send.pl +++ b/cmd/send.pl @@ -32,8 +32,9 @@ $loc->{rrreq} = '0'; if ($self->state eq "prompt") { - my @f = split /([\s\@\$])/, $line; + my @f = split /([\s\@\$,])/, $line; @f = map {s/\s+//g; length $_ ? $_ : ()} @f; + @f = grep {$_ ne ','} @f; # any thing after send? return (1, $self->msg('e6')) if !@f; @@ -109,6 +110,8 @@ if ($self->state eq "prompt") { # callsign ? $notincalls = 0; +# $DB::single = 1; + # is this callsign a distro? my $fn = "/spider/msg/distro/$f.pl"; if (-e $fn) { @@ -127,10 +130,14 @@ if ($self->state eq "prompt") { } } - if (grep $_ eq $f, @DXMsg::badmsg) { - push @out, $self->msg('m3', $f); + if (($loc->{private} && is_callsign($f)) || (!$loc->{private} && DXMsg::valid_bull_addr($f))) { + if (grep $_ eq $f, @DXMsg::badmsg) { + push @out, $self->msg('m3', $f); + } else { + push @to, $f; + } } else { - push @to, $f; + push @out, $self->msg('m3', $f); } } } @@ -140,7 +147,7 @@ if ($self->state eq "prompt") { $loc->{to} = \@to; } else { delete $self->{loc}; - return (1, $self->msg('e6')); + return (1, @out, $self->msg('e6')); } $loc->{from} ||= $self->call; unless (is_callsign($loc->{from})) { diff --git a/perl/DXMsg.pm b/perl/DXMsg.pm index 118feef4..dbcd8097 100644 --- a/perl/DXMsg.pm +++ b/perl/DXMsg.pm @@ -1182,6 +1182,32 @@ sub forward_it return 0; } +# +# look down the forward table to see whether this is a valid bull +# or not (ie it will forward somewhere even if it is only here) +# +sub valid_bull_addr +{ + my $call = shift; + my $i; + + unless (@forward) { + return 1 if $call =~ /^ALL/; + return 1 if $call =~ /^DX/; + return 0; + } + + for ($i = 0; $i < @forward; $i += 5) { + my ($sort, $field, $pattern, $action, $bbs) = @forward[$i..($i+4)]; + if ($field eq 'T') { + if (!$pattern || $call =~ m{$pattern}i) { + return 1; + } + } + } + return 0; +} + sub dump_it { my $ref = shift; -- 2.43.0