From 3cdd57e7baf63341fdcba6b764f304291ed0dbb2 Mon Sep 17 00:00:00 2001 From: Dirk Koopman Date: Sat, 10 May 2008 15:26:57 +0100 Subject: [PATCH] add privilege checks to (un)set/show/bad* cmds These commands now require at least privilege 6 and cannot be done remotely. --- Changes | 3 +++ cmd/Commands_en.hlp | 16 ++++++++-------- cmd/set/baddx.pl | 4 ++++ cmd/set/badnode.pl | 4 ++++ cmd/set/badspotter.pl | 3 +++ cmd/set/badword.pl | 4 ++++ cmd/show/baddx.pl | 4 ++++ cmd/show/badnode.pl | 4 ++++ cmd/show/badspotter.pl | 4 ++++ cmd/show/badword.pl | 4 ++++ cmd/unset/baddx.pl | 4 ++++ cmd/unset/badnode.pl | 4 ++++ cmd/unset/badspotter.pl | 4 ++++ cmd/unset/badword.pl | 4 ++++ perl/DXProtHandle.pm | 2 +- perl/Version.pm | 2 +- 16 files changed, 60 insertions(+), 10 deletions(-) diff --git a/Changes b/Changes index 2bb8b527..446b8752 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,6 @@ +10May08======================================================================= +1. add some privileges to (un)set/bad* and show/bad* commands. Thanks to +Mauro IV3SCP for pointing this out to me. 06May08======================================================================= 1. Finally made the incompatible change of changing DXUser->get* to DXUser::get*. This will break any third party addons or commands use these diff --git a/cmd/Commands_en.hlp b/cmd/Commands_en.hlp index c86d3119..f1f26cc1 100644 --- a/cmd/Commands_en.hlp +++ b/cmd/Commands_en.hlp @@ -1404,8 +1404,8 @@ allows you to see them again. This is the default. === 5^SET/ARCLUSTER [..]^Make the callsign an AR-Cluster node -=== 8^SET/BADDX ..^Stop callsigns in a dx spot being propagated -=== 8^UNSET/BADDX ..^Propagate a dx spot with this callsign again +=== 6^SET/BADDX ..^Stop callsigns in a dx spot being propagated +=== 6^UNSET/BADDX ..^Propagate a dx spot with this callsign again Setting a word as 'baddx' will prevent spots with that word in the 'spotted' field (as in: DX 14001.1 FR0G)of a DX spot from going any further. They will not be displayed and they will not be sent onto @@ -1419,8 +1419,8 @@ To allow a word again, use the following command ... unset/baddx VIDEO -=== 8^SET/BADNODE ..^Stop spots from this node being propagated -=== 8^UNSET/BADNODE ..^Allow spots from this node again +=== 6^SET/BADNODE ..^Stop spots from this node being propagated +=== 6^UNSET/BADNODE ..^Allow spots from this node again Setting a callsign as a 'badnode' will prevent spots from that node going any further. They will not be displayed and they will not be sent onto other nodes. @@ -1438,8 +1438,8 @@ will allow spots from him again. Use with extreme care. This command may well be superceeded by FILTERing. -=== 8^SET/BADSPOTTER ..^Stop spots from this callsign being propagated -=== 8^UNSET/BADSPOTTER ..^Allow spots from this callsign again +=== 6^SET/BADSPOTTER ..^Stop spots from this callsign being propagated +=== 6^UNSET/BADSPOTTER ..^Allow spots from this callsign again Setting a callsign as a 'badspotter' will prevent spots from this callsign going any further. They will not be displayed and they will not be sent onto other nodes. @@ -1462,8 +1462,8 @@ Use with extreme care. This command may well be superceded by FILTERing. This command will also stop TALK and ANNOUNCE/FULL from any user marked as a BADSPOTTER. -=== 8^SET/BADWORD ..^Stop things with this word being propagated -=== 8^UNSET/BADWORD ..^Propagate things with this word again +=== 6^SET/BADWORD ..^Stop things with this word being propagated +=== 6^UNSET/BADWORD ..^Propagate things with this word again Setting a word as a 'badword' will prevent things like spots, announces or talks with this word in the the text part from going any further. They will not be displayed and they will not be sent onto diff --git a/cmd/set/baddx.pl b/cmd/set/baddx.pl index 319e09ef..c62e5e31 100644 --- a/cmd/set/baddx.pl +++ b/cmd/set/baddx.pl @@ -6,5 +6,9 @@ # # my ($self, $line) = @_; +return (1, $self->msg('e5')) if $self->remotecmd; +# are we permitted? +return (1, $self->msg('e5')) if $self->priv < 6; +$line = join(' ', map {s|[/-]\d+$||; $_} split(/\s+/, $line)); return $DXProt::baddx->set(8, $self->msg('e6'), $self, $line); diff --git a/cmd/set/badnode.pl b/cmd/set/badnode.pl index abdd2e2b..b123ef96 100644 --- a/cmd/set/badnode.pl +++ b/cmd/set/badnode.pl @@ -6,5 +6,9 @@ # # my ($self, $line) = @_; +return (1, $self->msg('e5')) if $self->remotecmd; +# are we permitted? +return (1, $self->msg('e5')) if $self->priv < 6; +$line = join(' ', map {s|[/-]\d+$||; $_} split(/\s+/, $line)); return $DXProt::badnode->set(8, $self->msg('e12'), $self, $line); diff --git a/cmd/set/badspotter.pl b/cmd/set/badspotter.pl index 645e217e..0df37171 100644 --- a/cmd/set/badspotter.pl +++ b/cmd/set/badspotter.pl @@ -6,6 +6,9 @@ # # my ($self, $line) = @_; +return (1, $self->msg('e5')) if $self->remotecmd; +# are we permitted? +return (1, $self->msg('e5')) if $self->priv < 6; $line = join(' ', map {s|[/-]\d+$||; $_} split(/\s+/, $line)); return $DXProt::badspotter->set(8, $self->msg('e6'), $self, $line); diff --git a/cmd/set/badword.pl b/cmd/set/badword.pl index 7df13cff..2879388f 100644 --- a/cmd/set/badword.pl +++ b/cmd/set/badword.pl @@ -6,5 +6,9 @@ # # my ($self, $line) = @_; +return (1, $self->msg('e5')) if $self->remotecmd; +# are we permitted? +return (1, $self->msg('e5')) if $self->priv < 6; +$line = join(' ', map {s|[/-]\d+$||; $_} split(/\s+/, $line)); return $BadWords::badword->set(8, $self->msg('e6'), $self, $line); diff --git a/cmd/show/baddx.pl b/cmd/show/baddx.pl index 7780e46b..49133c51 100644 --- a/cmd/show/baddx.pl +++ b/cmd/show/baddx.pl @@ -6,5 +6,9 @@ # # my ($self, $line) = @_; +return (1, $self->msg('e5')) if $self->remotecmd; +# are we permitted? +return (1, $self->msg('e5')) if $self->priv < 6; +$line = join(' ', map {s|[/-]\d+$||; $_} split(/\s+/, $line)); return $DXProt::baddx->show(1, $self); diff --git a/cmd/show/badnode.pl b/cmd/show/badnode.pl index f8aa263c..e5693651 100644 --- a/cmd/show/badnode.pl +++ b/cmd/show/badnode.pl @@ -6,5 +6,9 @@ # # my ($self, $line) = @_; +return (1, $self->msg('e5')) if $self->remotecmd; +# are we permitted? +return (1, $self->msg('e5')) if $self->priv < 6; +$line = join(' ', map {s|[/-]\d+$||; $_} split(/\s+/, $line)); return $DXProt::badnode->show(1, $self); diff --git a/cmd/show/badspotter.pl b/cmd/show/badspotter.pl index 272e74c3..472d15d5 100644 --- a/cmd/show/badspotter.pl +++ b/cmd/show/badspotter.pl @@ -6,5 +6,9 @@ # # my ($self, $line) = @_; +return (1, $self->msg('e5')) if $self->remotecmd; +# are we permitted? +return (1, $self->msg('e5')) if $self->priv < 6; +$line = join(' ', map {s|[/-]\d+$||; $_} split(/\s+/, $line)); return $DXProt::badspotter->show(1, $self); diff --git a/cmd/show/badword.pl b/cmd/show/badword.pl index 0b5bbec3..a2b4ce86 100644 --- a/cmd/show/badword.pl +++ b/cmd/show/badword.pl @@ -6,5 +6,9 @@ # # my ($self, $line) = @_; +return (1, $self->msg('e5')) if $self->remotecmd; +# are we permitted? +return (1, $self->msg('e5')) if $self->priv < 6; +$line = join(' ', map {s|[/-]\d+$||; $_} split(/\s+/, $line)); return $BadWords::badword->show(1, $self); diff --git a/cmd/unset/baddx.pl b/cmd/unset/baddx.pl index 58760050..84d4d5fe 100644 --- a/cmd/unset/baddx.pl +++ b/cmd/unset/baddx.pl @@ -6,5 +6,9 @@ # # my ($self, $line) = @_; +return (1, $self->msg('e5')) if $self->remotecmd; +# are we permitted? +return (1, $self->msg('e5')) if $self->priv < 6; +$line = join(' ', map {s|[/-]\d+$||; $_} split(/\s+/, $line)); return $DXProt::baddx->unset(8, $self->msg('e6'), $self, $line); diff --git a/cmd/unset/badnode.pl b/cmd/unset/badnode.pl index 12f143ab..cd44a0aa 100644 --- a/cmd/unset/badnode.pl +++ b/cmd/unset/badnode.pl @@ -6,5 +6,9 @@ # # my ($self, $line) = @_; +return (1, $self->msg('e5')) if $self->remotecmd; +# are we permitted? +return (1, $self->msg('e5')) if $self->priv < 6; +$line = join(' ', map {s|[/-]\d+$||; $_} split(/\s+/, $line)); return $DXProt::badnode->unset(8, $self->msg('e12'), $self, $line); diff --git a/cmd/unset/badspotter.pl b/cmd/unset/badspotter.pl index 8259133b..20c5569f 100644 --- a/cmd/unset/badspotter.pl +++ b/cmd/unset/badspotter.pl @@ -6,6 +6,10 @@ # # my ($self, $line) = @_; +return (1, $self->msg('e5')) if $self->remotecmd; +# are we permitted? +return (1, $self->msg('e5')) if $self->priv < 6; +$line = join(' ', map {s|[/-]\d+$||; $_} split(/\s+/, $line)); $line = join(' ', map {s|[/-]\d+$||; $_} split(/\s+/, $line)); return $DXProt::badspotter->unset(8, $self->msg('e6'), $self, $line); diff --git a/cmd/unset/badword.pl b/cmd/unset/badword.pl index 6a38d775..d2b7fe31 100644 --- a/cmd/unset/badword.pl +++ b/cmd/unset/badword.pl @@ -6,5 +6,9 @@ # # my ($self, $line) = @_; +return (1, $self->msg('e5')) if $self->remotecmd; +# are we permitted? +return (1, $self->msg('e5')) if $self->priv < 6; +$line = join(' ', map {s|[/-]\d+$||; $_} split(/\s+/, $line)); return $BadWords::badword->unset(8, $self->msg('e6'), $self, $line); diff --git a/perl/DXProtHandle.pm b/perl/DXProtHandle.pm index e7160d7c..f2d5b559 100644 --- a/perl/DXProtHandle.pm +++ b/perl/DXProtHandle.pm @@ -1709,7 +1709,7 @@ sub handle_92 } } elsif ($sort eq 'K') { - $pc92Kin += length $line if $sort eq 'K'; + $pc92Kin += length $line; # remember the last channel we arrived on $parent->PC92C_dxchan($self->{call}) unless $self->{call} eq $parent->call; diff --git a/perl/Version.pm b/perl/Version.pm index b5ad051a..34f9aaff 100644 --- a/perl/Version.pm +++ b/perl/Version.pm @@ -11,6 +11,6 @@ use vars qw($version $subversion $build); $version = '1.55'; $subversion = '0'; -$build = '5'; +$build = '6'; 1; -- 2.43.0