From 9e13a6bbc1394541f11c75a82805a6e4966e3e9c Mon Sep 17 00:00:00 2001 From: djk Date: Mon, 15 Nov 1999 14:06:39 +0000 Subject: [PATCH] add set/var and show/var - two rather insecure commands! --- Changes | 3 +++ cmd/connect.pl | 1 + cmd/set/var.pl | 21 +++++++++++++++++++++ cmd/show/var.pl | 30 ++++++++++++++++++++++++++++++ perl/DXProt.pm | 2 +- perl/cluster.pl | 2 ++ 6 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 cmd/set/var.pl create mode 100644 cmd/show/var.pl diff --git a/Changes b/Changes index 19a866ec..e6271715 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,6 @@ +14Nov99======================================================================= +1. added BBS.pm to start BBS input of mail +2. fixed eval in DXUser to log errors rather than banging out 12Nov99======================================================================= 1. added sh/sun command kindly supplied by Steve K9AN. 2. allow ^Z on its own on a line to terminate a message diff --git a/cmd/connect.pl b/cmd/connect.pl index 14f94bb3..d4a11d2a 100644 --- a/cmd/connect.pl +++ b/cmd/connect.pl @@ -22,6 +22,7 @@ if (defined $pid) { eval "{ package DB; sub DB {} }"; alarm(0); DXChannel::closeall(); + Msg::close_server(); $SIG{CHLD} = $SIG{TERM} = $SIG{INT} = $SIG{__WARN__} = 'DEFAULT'; exec $prog, $call, 'connect'; } else { diff --git a/cmd/set/var.pl b/cmd/set/var.pl new file mode 100644 index 00000000..1870d1a6 --- /dev/null +++ b/cmd/set/var.pl @@ -0,0 +1,21 @@ +# +# set any variable +# +# Rape me! +# +# Copyright (c) 1999 - Dirk Koopman G1TLH +# +# $Id$ +# + +my ($self, $line) = @_; +return (1, $self->msg('e5')) if $self->priv < 9 || $self->remotecmd; +my ($var, $rest) = split /\s+/, $line, 2; +$rest =~ s/^=\s*//; +Log('DXCommand', $self->call . " set $var = $rest" ); +eval "$var = $rest"; +return (1, $@ ? $@ : "Ok, $var = $rest" ); + + + + diff --git a/cmd/show/var.pl b/cmd/show/var.pl new file mode 100644 index 00000000..7f73558e --- /dev/null +++ b/cmd/show/var.pl @@ -0,0 +1,30 @@ +# +# show any variable +# +# Rape me! +# +# Copyright (c) 1999 - Dirk Koopman G1TLH +# +# $Id$ +# + +my ($self, $line) = @_; +return (1, $self->msg('e5')) if $self->priv < 9 || $self->remotecmd; +my @f = split /\s+/, $line; +my $f; +my @out; + +foreach $f (@f) { + print "\$f = $f\n"; + my $var = eval "$f"; + if ($var) { + my $s = Data::Dumper->Dump([ $var ], [ "$f" ]); + push @out, $s; + Log('DXCommand', $self->call . " show/var $s"); + } else { + push @out, $@ ? $@ : $self->msg('e3', 'show/var', $f); + Log('DXCommand', $self->call . " show/var $f not found" ); + } +} + +return (1, @out); diff --git a/perl/DXProt.pm b/perl/DXProt.pm index d467a5d5..234c7bca 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -41,7 +41,7 @@ $pc23_max_age = 1*3600; # the maximum age for an incoming 'real-time' pc23 $pc11_dup_age = 24*3600; # the maximum time to keep the spot dup list for $pc23_dup_age = 24*3600; # the maximum time to keep the wwv dup list for $pc12_dup_age = 12*3600; # the maximum time to keep the ann dup list for -$pc12_dup_lth = 72; # the length of ANN text to save for deduping +$pc12_dup_lth = 60; # the length of ANN text to save for deduping %spotdup = (); # the pc11 and 26 dup hash %wwvdup = (); # the pc23 and 27 dup hash %anndup = (); # the PC12 dup hash diff --git a/perl/cluster.pl b/perl/cluster.pl index 0ed98e55..0e93c4e9 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -60,6 +60,8 @@ use CmdAlias; use Filter; use Local; use DXDb; +use Data::Dumper; + use Fcntl ':flock'; use Carp qw(cluck); -- 2.43.0