]> dxcluster.org Git - spider.git/commitdiff
fix DXSubcommand thaw protection
authorDirk Koopman <djk@tobit.co.uk>
Sat, 23 May 2020 15:30:36 +0000 (16:30 +0100)
committerDirk Koopman <djk@tobit.co.uk>
Sat, 23 May 2020 15:30:36 +0000 (16:30 +0100)
perl/DXSubprocess.pm
perl/Msg.pm

index 6ff5adae1bbba143f2531007359e19bd31ed9a09..e9624c7d8da4bebd0c961e7563f2ea084add4813 100644 (file)
@@ -29,7 +29,7 @@ sub freeze
        my $j = shift;
        unless ($j) {
                LogDbg('DXUser', "DXSubcommand::freeze: undefined or empty input");
-               return q{[null, ""]};
+               return q{[null, '']};
        }
        
        eval { $r = encode_json($j) };
@@ -47,14 +47,14 @@ sub thaw
        my $j = shift;
        unless ($j) {
                LogDbg('DXUser', "DXSubcommand::thaw: empty string on input");
-               return q{[null, ""]};
+               return [undef,[0]];
        }
 
        return [undef, [1]] unless $j; 
        eval { $r = decode_json($j) };
        if ($@) {
                LogDbg('DXUser', "DXSubcommand::thaw: json error on '$j': $@");
-               $r = qq{[$@,[1]]};
+               $r = [$@,[0]];
        }
        return $r;
 }
index 5e40d3c2afa5bdfb86e9a8b3aaf302a551f3ebd6..9ea2bc10c9aaad10a3f9e8ca0d96b6d95b522b69 100644 (file)
@@ -482,7 +482,7 @@ sub new_client {
        $sock->on(read => sub {$conn->_rcv($_[1])});
        $sock->timeout(0);
        $sock->start;
-       $conn->{peerhost} = $handle->peerhost;
+       $conn->{peerhost} = $handle->peerhost || 'unknown';
        $conn->{peerhost} =~ s|^::ffff:||; # chop off leading pseudo IPV6 stuff on dual stack listeners
        $conn->{peerport} = $handle->peerport;
        dbg((ref $conn) . " accept $conn->{cnum} from $conn->{peerhost}:$conn->{peerport}") if isdbg('conn') || isdbg('connect');