Hardened up the cluster->client link in the cluster software so that

rubbish on port 27754 doesn't (usually) crash the cluster.
This commit is contained in:
djk 2000-06-18 00:31:17 +00:00
parent aba7a0d5b7
commit 72e9dcbade
3 changed files with 27 additions and 6 deletions

View File

@ -4,6 +4,8 @@
3. added update_sysop.pl which cleans out all previous versions of the sysops
information from the user database and recreates it with that in DXVars.pm
4. Added node type to links and who
5. Hardened up the cluster->client link in the cluster software so that
rubbish on port 27754 doesn't (usually) crash the cluster.
14Jun00=======================================================================
1. fixed sh/node crash
2. fixed RTT in who.pl

View File

@ -436,6 +436,26 @@ sub field_prompt
return $valid{$ele};
}
# take a standard input message and decode it into its standard parts
sub decode_input
{
my $dxchan = shift;
my $data = shift;
my ($sort, $call, $line) = $data =~ /^([A-Z])([A-Z1-9\-]{3,9})\|(.*)$/;
my $chcall = (ref $dxchan) ? $dxchan->call : "UN.KNOWN";
# the above regexp must work
if (!defined $sort || !defined $call || !defined $line ||
(ref $dxchan && $call ne $chcall)) {
$data =~ s/([\x00-\x1f\x7f-\xff])/uc sprintf("%%%02x",ord($1))/eg;
dbg('chan', "DUFF Line from $chcall: $data");
return ();
}
return ($sort, $call, $line);
}
no strict;
sub AUTOLOAD
{

View File

@ -120,7 +120,8 @@ sub rec
# set up the basic channel info - this needs a bit more thought - there is duplication here
if (!defined $dxchan) {
my ($sort, $call, $line) = $msg =~ /^(\w)(\S+)\|(.*)$/;
my ($sort, $call, $line) = DXChannel::decode_input(0, $msg);
return unless defined $sort;
# is there one already connected to me - locally?
my $user = DXUser->get($call);
@ -246,11 +247,9 @@ sub process_inqueue
my $data = $self->{data};
my $dxchan = $self->{dxchan};
my ($sort, $call, $line) = $data =~ /^(\w)([^\|]+)\|(.*)$/;
my $error;
# the above regexp must work
return unless ($sort && $call && $line);
my ($sort, $call, $line) = DXChannel::decode_input($dxchan, $data);
return unless defined $sort;
# translate any crappy characters into hex characters
if ($line =~ /[\x00-\x06\x08\x0a-\x1f\x7f-\xff]/o) {