summaryrefslogtreecommitdiff
path: root/fml
diff options
context:
space:
mode:
authorfukachan <fukachan>2002-03-23 12:22:03 +0000
committerfukachan <fukachan>2002-03-23 12:22:03 +0000
commit0bc5ee672008a8b32840fb0cff40f3de40237e76 (patch)
tree83afbe0c39806d4caadec50513ac4221584dc8a8 /fml
parentbb85781643278186368d692c1136826cd71870cc (diff)
downloadfml8-0bc5ee672008a8b32840fb0cff40f3de40237e76.tar.gz
fml8-0bc5ee672008a8b32840fb0cff40f3de40237e76.tar.bz2
fml8-0bc5ee672008a8b32840fb0cff40f3de40237e76.zip
clean up
use rewrite_prompt() by FML::Command to hide admin password.
Diffstat (limited to 'fml')
-rw-r--r--fml/lib/FML/Process/Command.pm25
1 files changed, 20 insertions, 5 deletions
diff --git a/fml/lib/FML/Process/Command.pm b/fml/lib/FML/Process/Command.pm
index d88f8e83..52f630e6 100644
--- a/fml/lib/FML/Process/Command.pm
+++ b/fml/lib/FML/Process/Command.pm
@@ -3,7 +3,7 @@
# Copyright (C) 2000,2001,2002 Ken'ichi Fukamachi
# All rights reserved.
#
-# $FML: Command.pm,v 1.38 2002/03/22 11:40:27 fukachan Exp $
+# $FML: Command.pm,v 1.39 2002/03/22 15:30:44 fukachan Exp $
#
package FML::Process::Command;
@@ -327,6 +327,9 @@ sub _auth_admin
else {
return 0;
}
+
+ # deny transition to admin mode by default
+ return 0;
}
@@ -413,12 +416,19 @@ sub _evaluate_command
}
# Case: "admin" command is exceptional. try priviledged mode.
elsif ($comname =~ /$admin_prefix/) {
- unless ($is_auth) { # for the first time ?
+ if ($is_auth) {
+ Log("admin auth already: $command");
+ }
+ else { # for the first time ?
my $sender = $curproc->{'credential'}->{'sender'};
- my $optargs = { address => $sender, data => $command };
+ my $data = $command;
+ $data =~ s/.*(password|pass)\s+//;
+ my $optargs = { address => $sender, password => $data };
+
# try auth by FML::Command::Auth;
$is_auth = $curproc->_auth_admin($args, $optargs);
+ Log("authenticated as an ML administrator") if $is_auth;
}
if ($is_admin && $is_auth) {
@@ -472,8 +482,6 @@ sub _evaluate_command
use FML::Command;
my $obj = new FML::Command;
if (defined $obj) {
- $curproc->reply_message("\n$prompt $orig_command");
-
# arguments to pass off to each method
my $command_args = {
command_mode => $mode,
@@ -485,7 +493,14 @@ sub _evaluate_command
args => $args,
};
+ # rewrite prompt e.g. to hide the password
+ $obj->rewrite_prompt($curproc, $command_args, \$orig_command);
+
+ # reply buffer
+ $curproc->reply_message("\n$prompt $orig_command");
+
# execute command ($comname method) under eval().
+ # XXX $obj = FML::Command object NOT FML::Command::$mode::$command
eval q{
$obj->$comname($curproc, $command_args);
};