summaryrefslogtreecommitdiff
path: root/fml/lib/FML/Process/Command.pm
diff options
context:
space:
mode:
authorfukachan <fukachan>2002-05-19 11:49:24 +0000
committerfukachan <fukachan>2002-05-19 11:49:24 +0000
commit328af593a50924074967d40960fc7c4b2cd45b1f (patch)
tree34616cc3b2ebce7c268c699d2b0c8e21f8852044 /fml/lib/FML/Process/Command.pm
parent9813997098b445f901a28da6a39eff2238ce5af7 (diff)
downloadfml8-328af593a50924074967d40960fc7c4b2cd45b1f.tar.gz
fml8-328af593a50924074967d40960fc7c4b2cd45b1f.tar.bz2
fml8-328af593a50924074967d40960fc7c4b2cd45b1f.zip
better error message
Diffstat (limited to 'fml/lib/FML/Process/Command.pm')
-rw-r--r--fml/lib/FML/Process/Command.pm31
1 files changed, 27 insertions, 4 deletions
diff --git a/fml/lib/FML/Process/Command.pm b/fml/lib/FML/Process/Command.pm
index b34c1869..61c54fdd 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.56 2002/05/19 09:05:02 fukachan Exp $
+# $FML: Command.pm,v 1.57 2002/05/19 11:14:30 fukachan Exp $
#
package FML::Process::Command;
@@ -466,8 +466,9 @@ sub _get_command_mode
}
}
else {
- LogError("privileged command from not an admin user");
- LogError("command processing stop.");
+ $status->{ _stop_reason_key } = 'command.auth_fail';
+ $status->{ _stop_reason_str } = "not authenticated.";
+ LogError("admin command not authenticated");
return '__LAST__';
}
}
@@ -563,6 +564,27 @@ sub __clean_up
}
+sub __stop_here
+{
+ my ($curproc, $args, $status, $cominfo, $orig_command) = @_;
+ my $config = $curproc->{ config };
+ my $prompt = $config->{ command_prompt } || '>>>';
+ my $key = $status->{ _stop_reason_key };
+ my $str = $status->{ _stop_reason_str };
+
+ use FML::Command;
+ my $obj = new FML::Command;
+ if (defined $obj) {
+ # rewrite prompt e.g. to hide the password
+ my $command_args = $curproc->_gen_command_args($status, $cominfo);
+ $obj->rewrite_prompt($curproc, $command_args, \$orig_command);
+ $curproc->reply_message("\n$prompt $orig_command");
+ $curproc->reply_message_nl($key, $str);
+ $curproc->reply_message_nl('command.stop', "stopped.");
+ }
+}
+
+
# Descriptions: scan message body and execute approviate command
# with dynamic loading of command definition.
# It resolves your customized command easily.
@@ -630,7 +652,8 @@ sub _evaluate_command_lines
next COMMAND;
}
unless ($mode eq 'user' || $mode eq 'admin') {
- LogError("command processing looks insane. stop.");
+ LogError("command processing stop.");
+ $curproc->__stop_here($args, $status, $cominfo, $orig_command);
last COMMAND;
}