summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfukachan <fukachan>2002-02-23 11:02:17 +0000
committerfukachan <fukachan>2002-02-23 11:02:17 +0000
commit0f4bba7a5b102505e2ffbfbaa1cad42ac376d083 (patch)
treecc3ae711739e52996ff85bb5e555c35da46c9131
parent02d0774808609d69427fc601dae4a9fa27e127bf (diff)
downloadfml8-0f4bba7a5b102505e2ffbfbaa1cad42ac376d083.tar.gz
fml8-0f4bba7a5b102505e2ffbfbaa1cad42ac376d083.tar.bz2
fml8-0f4bba7a5b102505e2ffbfbaa1cad42ac376d083.zip
validate if the requested admin command is permited or not.
define $available_commands_for_privileged_user rename $available_commands -> $available_commands_for_user
-rw-r--r--fml/etc/default_config.cf.ja.in14
-rw-r--r--fml/etc/src/config.cf.ja/command.cf14
-rw-r--r--fml/lib/FML/Process/Command.pm18
3 files changed, 41 insertions, 5 deletions
diff --git a/fml/etc/default_config.cf.ja.in b/fml/etc/default_config.cf.ja.in
index da8f9a4c..b1e18c6f 100644
--- a/fml/etc/default_config.cf.ja.in
+++ b/fml/etc/default_config.cf.ja.in
@@ -566,7 +566,7 @@ command_unsubscribe_type = confirmation
# 変更を加える
# Value:
# Examples:
-available_commands = help
+available_commands_for_user = help
get
mget
get
@@ -595,6 +595,18 @@ available_commands_for_stranger = guide
$confirm_keyword
+available_commands_for_privileged_user = subscribe
+ add
+ unsubscribe
+ bye
+ remove
+ resign
+ signoff
+ get
+ mget
+ send
+
+
confirm_command_prefix = confirm
diff --git a/fml/etc/src/config.cf.ja/command.cf b/fml/etc/src/config.cf.ja/command.cf
index fe5b21b2..5c47f86b 100644
--- a/fml/etc/src/config.cf.ja/command.cf
+++ b/fml/etc/src/config.cf.ja/command.cf
@@ -34,7 +34,7 @@ command_unsubscribe_type = confirmation
# 変更を加える
# Value:
# Examples:
-available_commands = help
+available_commands_for_user = help
get
mget
get
@@ -63,6 +63,18 @@ available_commands_for_stranger = guide
$confirm_keyword
+available_commands_for_privileged_user = subscribe
+ add
+ unsubscribe
+ bye
+ remove
+ resign
+ signoff
+ get
+ mget
+ send
+
+
confirm_command_prefix = confirm
diff --git a/fml/lib/FML/Process/Command.pm b/fml/lib/FML/Process/Command.pm
index a3769166..47d04df6 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.34 2002/02/17 09:14:41 fukachan Exp $
+# $FML: Command.pm,v 1.35 2002/02/17 13:51:49 fukachan Exp $
#
package FML::Process::Command;
@@ -235,6 +235,7 @@ sub _can_accpet_command
my $config = $curproc->{ config };
my $cred = $curproc->{ credential }; # user credential
my $prompt = $config->{ command_prompt } || '>>>';
+ my $mode = $opts->{ mode };
my $comname = $opts->{ comname };
my $command = $opts->{ command };
@@ -249,7 +250,7 @@ sub _can_accpet_command
}
# 2. use of this command is allowed in FML::Config or not ?
- unless ($config->has_attribute("available_commands", $comname)) {
+ unless ($config->has_attribute("available_commands_for_$mode", $comname)) {
$curproc->reply_message("\n$prompt $command");
$curproc->reply_message_nl('command.not_command',
"not command, ignored.");
@@ -373,6 +374,16 @@ sub _evaluate_command
Log("try $comname <$command>");
$command =~ s/^.*$comname/admin $comname/;
+
+ my $opts = {
+ mode => 'privileged_user',
+ comname => $comname,
+ command => $command };
+ unless ($curproc->_can_accpet_command($args, $opts)) {
+ # no, we do not accept this command.
+ Log("invalid command = $command");
+ next COMMAND;
+ }
}
# Case: commands except for 'admin' nor "confirm" reply message.
# check whether we need to accpet this command ?
@@ -381,7 +392,8 @@ sub _evaluate_command
# validate general command except for confirmation
# if $id is 1, this message must be confirmation reply.
else {
- my $opts = { comname => $comname, command => $command };
+ my $opts = {
+ mode => 'user', comname => $comname, command => $command };
unless ($curproc->_can_accpet_command($args, $opts)) {
# no, we do not accept this command.
Log("invalid command = $command");