From: Dirk Koopman Date: Fri, 9 Mar 2012 22:13:29 +0000 (+0000) Subject: try to fix unblessed refs in PC34s X-Git-Tag: 1.57~32 X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=dabf8497c51068614efdd147f35c0a143f547424;p=spider.git try to fix unblessed refs in PC34s --- diff --git a/Changes b/Changes index abdfcc56..32a1306a 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,5 @@ +09Mar12======================================================================= +1. Try to trap unblessed references on receipt of PC34s 15Feb12======================================================================= 1. Add CTY2202 changes 25Jan12======================================================================= diff --git a/perl/DXProt.pm b/perl/DXProt.pm index 494b4348..e0db5fa7 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -1111,9 +1111,19 @@ sub process_rcmd my ($self, $tonode, $fromnode, $user, $cmd) = @_; if ($tonode eq $main::mycall) { my $ref = DXUser::get_current($fromnode); + unless ($ref && UNIVERSAL($ref, 'DXUser')) { + dbg("DXProt process_rcmd: user $fromnode isn't a reference (check user_asc and tell G1TLH)"); + $self->send_rcmd_reply($main::mycall, $fromnode, $user, "sorry...!"); + return; + } my $cref = Route::Node::get($fromnode); + unless ($cref && UNIVERSAL($cref, 'Route')) { + dbg("DXProt process_rcmd: Route $fromnode isn't a reference (tell G1TLH)"); + $self->send_rcmd_reply($main::mycall, $fromnode, $user, "sorry...!"); + return; + } Log('rcmd', 'in', ($ref->{priv}||0), $fromnode, $cmd); - if ($cmd !~ /^\s*rcmd/i && $cref && $ref && $ref->homenode && $cref->call eq $ref->homenode) { # not allowed to relay RCMDS! + if ($cmd !~ /^\s*rcmd/i && $ref->homenode && $cref->call eq $ref->homenode) { # not allowed to relay RCMDS! if ($ref->{priv}) { # you have to have SOME privilege, the commands have further filtering $self->{remotecmd} = 1; # for the benefit of any command that needs to know my $oldpriv = $self->{priv}; diff --git a/perl/DXUser.pm b/perl/DXUser.pm index 94fa3d1a..419086ad 100644 --- a/perl/DXUser.pm +++ b/perl/DXUser.pm @@ -249,10 +249,11 @@ sub get unless ($dbm->get($call, $data)) { $ref = decode($data); if ($ref) { - if (ref $ref ne 'DXUser') { + if (UNIVERSAL::isa($ref, 'DXUser')) { dbg("DXUser::get: got strange answer from decode ". ref $ref. " ignoring"); return undef; } + # we have a reference and it *is* a DXUser } else { dbg("DXUser::get: no reference returned from decode $!"); return undef; @@ -278,7 +279,7 @@ sub get_current my $dxchan = DXChannel::get($call); if ($dxchan) { my $ref = $dxchan->user; - return $ref if ref $ref eq 'DXUser'; + return $ref if $ref && UNIVERSAL::isa($ref, 'DXUser'); dbg("DXUser::get_current: got invalid user ref from dxchan $dxchan->{call} ". ref $ref. " ignoring"); }