From 9971e7bd96ea646b7921528a2f74edca508a5dc1 Mon Sep 17 00:00:00 2001 From: minima Date: Thu, 25 Oct 2001 13:51:34 +0000 Subject: [PATCH] add unset/password command to delete a user password --- Changes | 3 +++ cmd/Commands_en.hlp | 4 ++++ cmd/unset/password.pl | 37 +++++++++++++++++++++++++++++++++++++ perl/DXUser.pm | 6 ++++++ perl/Messages | 1 + 5 files changed, 51 insertions(+) create mode 100644 cmd/unset/password.pl diff --git a/Changes b/Changes index e7df720f..01ce2a56 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,6 @@ +25Oct01======================================================================= +1. added unset/password command to allow sysops (only) to completely delete +and remove a user's password. 24Oct01======================================================================= 1. added (un)set/register, show/registered commands which when a 'set/var $main::reqreg = 1' is done in the startup script will require users to diff --git a/cmd/Commands_en.hlp b/cmd/Commands_en.hlp index f84d19e8..09c69df3 100644 --- a/cmd/Commands_en.hlp +++ b/cmd/Commands_en.hlp @@ -1374,6 +1374,10 @@ is set or the: command is executed in the startup script, then a password prompt is given after the normal 'login: ' prompt. +=== 9^UNSET/PASSWORD ...^Delete (remove) a user's password +This command allows the sysop to completely delete and remove a +password for a user. + === 5^SET/SPIDER [..]^Make the callsign an DXSpider node Tell the system that the call(s) are to be treated as DXSpider node and fed new style DX Protocol rather normal user commands. diff --git a/cmd/unset/password.pl b/cmd/unset/password.pl new file mode 100644 index 00000000..6fdc9257 --- /dev/null +++ b/cmd/unset/password.pl @@ -0,0 +1,37 @@ +# +# unset a user's password +# +# Copyright (c) 2001 Dirk Koopman G1TLH +# +# Syntax: unset/pass ... +# + +my ($self, $line) = @_; +my @args = split /\s+/, $line; +my @out; +my $user; +my $ref; + +if ($self->remotecmd) { + Log('DXCommand', $self->call . " attempted to unset password for @args remotely"); + return (1, $self->msg('e5')); +} + +if ($self->priv < 9) { + Log('DXCommand', $self->call . " attempted to unset password for @args"); + return (1, $self->msg('e5')); +} + +for (@args) { + my $call = uc $_; + if ($ref = DXUser->get_current($call)) { + $ref->unset_passwd; + $ref->put(); + push @out, $self->msg("passwordu", $call); + Log('DXCommand', $self->call . " unset password for $call"); + } else { + push @out, $self->msg('e3', 'User record for', $call); + } +} + +return (1, @out); diff --git a/perl/DXUser.pm b/perl/DXUser.pm index f16494f9..c9725f27 100644 --- a/perl/DXUser.pm +++ b/perl/DXUser.pm @@ -580,6 +580,12 @@ sub is_ak1a my $self = shift; return $self->{sort} eq 'A'; } + +sub unset_passwd +{ + my $self = shift; + delete $self->{passwd}; +} 1; __END__ diff --git a/perl/Messages b/perl/Messages index bc1f8df5..815d09fc 100644 --- a/perl/Messages +++ b/perl/Messages @@ -194,6 +194,7 @@ package DXM; pagelth => 'Page Length is now $_[0]', passerr => 'Please use: SET/PASS ', password => 'Password set or changed for $_[0]', + passwordu => 'Password removed for $_[0]', pingo => 'Ping Started to $_[0]', pingi => 'Ping Returned from $_[0] $_[1] (Ave $_[2]) secs', pinge1 => 'Cannot ping yourself!', -- 2.43.0