From aaf4228b14eaaaf1d8510ed9e46c373fd41092b3 Mon Sep 17 00:00:00 2001 From: minima Date: Sun, 19 Nov 2000 14:21:19 +0000 Subject: [PATCH] added some more checking around PC16,17,19,21 --- perl/DXCluster.pm | 10 +++++----- perl/DXProt.pm | 43 +++++++++++++++++++++++++++++++++---------- 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/perl/DXCluster.pm b/perl/DXCluster.pm index f87dfdfc..1b810654 100644 --- a/perl/DXCluster.pm +++ b/perl/DXCluster.pm @@ -27,7 +27,7 @@ use vars qw(%cluster %valid); call => '0,Callsign', confmode => '0,Conference Mode,yesno', here => '0,Here?,yesno', - dxchan => '5,Channel Call', + dxchancall => '5,Channel Call', pcversion => '5,Node Version', list => '5,User List,DXCluster::dolist', users => '0,No of Users', @@ -41,7 +41,7 @@ sub alloc $self->{call} = $call; $self->{confmode} = $confmode; $self->{here} = $here; - $self->{dxchan} = $dxchan->call; + $self->{dxchancall} = $dxchan->call; $cluster{$call} = bless $self, $pkg; return $self; @@ -167,11 +167,11 @@ sub dxchan my $dxchan = shift; if ($dxchan) { - $self->{dxchan} = $dxchan->call; + $self->{dxchancall} = $dxchan->call; } else { - $dxchan = DXChannel->get($self->{dxchan}); + $dxchan = DXChannel->get($self->{dxchancall}); unless ($dxchan) { - my $dxcall = $self->{dxchan}; + my $dxcall = $self->{dxchancall}; my $call = $self->{call}; dbg('err', "parent dxchan $dxcall has disappeared from $call" ); } diff --git a/perl/DXProt.pm b/perl/DXProt.pm index f429c7ce..8571a2fa 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -500,11 +500,15 @@ sub normal # add it to the node table if it isn't present and it's # connected locally $node = DXNode->new($dxchan, $field[1], 0, 1, 5400); - broadcast_ak1a(pc19($dxchan, $node), $dxchan, $self) unless $dxchan->{isolate}; + dbg('chan', "$field[1] no PC19 yet, autovivified as node"); +# broadcast_ak1a(pc19($dxchan, $node), $dxchan, $self) unless $dxchan->{isolate}; } return unless $node; # ignore if havn't seen a PC19 for this one yet - return unless $node->isa('DXNode'); + unless ($node->isa('DXNode')) { + dbg('chan', "$field[1] is not a node"); + return; + } if ($node->dxchan != $self) { dbg('chan', "LOOP: $field[1] came in on wrong channel"); return; @@ -517,10 +521,17 @@ sub normal for ($i = 2; $i < $#field; $i++) { my ($call, $confmode, $here) = $field[$i] =~ /^(\S+) (\S) (\d)/o; - next if !$call || length $call < 3 || length $call > 8; - next if !$confmode; - $call = uc $call; - next if DXCluster->get_exact($call); # we already have this (loop?) + next unless $call && $confmode && defined $here && is_callsign($call); + my $ref = DXCluster->get_exact($call); + if ($ref) { + if ($ref->isa('DXNode')) { + dbg('chan', "LOOP: $call is a node"); + next; + } + my $rcall = $ref->call; + dbg('chan', "LOOP: already have $call on $rcall"); + next; + } $confmode = $confmode eq '*'; DXNodeuser->new($self, $node, $call, $confmode, $here); @@ -547,11 +558,14 @@ sub normal # add it to the node table if it isn't present and it's # connected locally $node = DXNode->new($dxchan, $field[2], 0, 1, 5400); - broadcast_ak1a(pc19($dxchan, $node), $dxchan, $self) unless $dxchan->{isolate}; - return; + dbg('chan', "$field[2] no PC19 yet, autovivified as node"); +# broadcast_ak1a(pc19($dxchan, $node), $dxchan, $self) unless $dxchan->{isolate}; } return unless $node; - return unless $node->isa('DXNode'); + unless ($node->isa('DXNode')) { + dbg('chan', "LOOP: $field[2] is not a node"); + return; + } if ($node->dxchan != $self) { dbg('chan', "LOOP: $field[2] came in on wrong channel"); return; @@ -561,7 +575,11 @@ sub normal return; } my $ref = DXCluster->get_exact($field[1]); - $ref->del() if $ref; + if ($ref) { + $ref->del; + } else { + dbg('chan', "$field[1] not known" ); + } last SWITCH; } @@ -588,6 +606,7 @@ sub normal my $call = uc $field[$i+1]; my $confmode = $field[$i+2]; my $ver = $field[$i+3]; + next unless defined $here && defined $confmode && is_callsign($call); $ver = 5400 if !$ver && $allowzero; @@ -652,6 +671,10 @@ sub normal if ($call ne $main::mycall) { # don't allow malicious buggers to disconnect me! my $node = DXCluster->get_exact($call); if ($node) { + unless ($node->isa('DXNode')) { + dbg('chan', "$call is not a node"); + return; + } if ($call eq $self->{call}) { dbg('chan', "LOOP: Trying to disconnect myself with PC21"); return; -- 2.34.1