]> dxcluster.net Git - spider.git/commitdiff
try to fix unblessed refs in PC34s
authorDirk Koopman <djk@tobit.co.uk>
Fri, 9 Mar 2012 22:13:29 +0000 (22:13 +0000)
committerDirk Koopman <djk@tobit.co.uk>
Fri, 9 Mar 2012 22:13:29 +0000 (22:13 +0000)
Changes
perl/DXProt.pm
perl/DXUser.pm

diff --git a/Changes b/Changes
index abdfcc56633c9325db48f8f1f1d45cdb68c26068..32a1306a904be8a6c888d715f61f104305827c7f 100644 (file)
--- 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=======================================================================
index 494b4348d9e13077b3ecf1d93766c331e24b4cef..e0db5fa7c8a11cf92a98fd1e9b5bf532269861de 100644 (file)
@@ -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};
index 94fa3d1a9ff1549fe2659b69444fef2915c565a9..419086adaa1230ef09e55772dc7fc17f625195f0 100644 (file)
@@ -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");
        }