summaryrefslogtreecommitdiff
path: root/fml/lib
diff options
context:
space:
mode:
authorfukachan <fukachan>2002-05-27 08:59:14 +0000
committerfukachan <fukachan>2002-05-27 08:59:14 +0000
commit9636a1a267556e84dd7487cd0c9ef74afd098041 (patch)
treeec0d3bdb52d312c95fd2c3e35168928e9a86f540 /fml/lib
parentae3064d26ff657899ea638f78f4f6c9a7c364fc0 (diff)
downloadfml8-9636a1a267556e84dd7487cd0c9ef74afd098041.tar.gz
fml8-9636a1a267556e84dd7487cd0c9ef74afd098041.tar.bz2
fml8-9636a1a267556e84dd7487cd0c9ef74afd098041.zip
rearrange admin command authentication to sync w/ new variable namings.
Diffstat (limited to 'fml/lib')
-rw-r--r--fml/lib/FML/Command/Auth.pm35
-rw-r--r--fml/lib/FML/Process/Command.pm15
2 files changed, 41 insertions, 9 deletions
diff --git a/fml/lib/FML/Command/Auth.pm b/fml/lib/FML/Command/Auth.pm
index cf3b0346..35f06bb1 100644
--- a/fml/lib/FML/Command/Auth.pm
+++ b/fml/lib/FML/Command/Auth.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: Auth.pm,v 1.4 2002/04/07 12:13:02 fukachan Exp $
+# $FML: Auth.pm,v 1.5 2002/04/10 09:57:22 fukachan Exp $
#
package FML::Command::Auth;
@@ -56,11 +56,40 @@ sub new
# Return Value: NUM
sub reject
{
+ return '__LAST__';
+}
+
+
+# Descriptions: permit anyone
+# Arguments: OBJ($self) HASH_REF($args)
+# Side Effects: none
+# Return Value: NUM
+sub permit_anyone
+{
+ return 1;
+}
+
+
+# Descriptions: virtual reject handler, just return 0 :-)
+# Arguments: OBJ($self) HASH_REF($args)
+# Side Effects: none
+# Return Value: NUM
+sub reject_system_accounts
+{
+ my ($self, $curproc, $args, $optargs) = @_;
+ my $cred = $curproc->{ credential };
+ my $match = $cred->match_system_accounts($curproc, $args);
+
+ if ($match) {
+ Log("reject_system_accounts: matches the sender");
+ return '__LAST__';
+ }
+
return 0;
}
-=head2 check_password($curproc, $args, $optargs)
+=head2 check_admin_member_password($curproc, $args, $optargs)
check the password if it is valid or not.
@@ -74,7 +103,7 @@ check the password if it is valid or not.
# HASH_REF($optargs)
# Side Effects: none
# Return Value: NUM
-sub check_password
+sub check_admin_member_password
{
my ($self, $curproc, $args, $optargs) = @_;
my $config = $curproc->{ config };
diff --git a/fml/lib/FML/Process/Command.pm b/fml/lib/FML/Process/Command.pm
index 61c54fdd..e237c1a4 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.57 2002/05/19 11:14:30 fukachan Exp $
+# $FML: Command.pm,v 1.58 2002/05/19 11:49:24 fukachan Exp $
#
package FML::Process::Command;
@@ -359,16 +359,19 @@ sub _auth_admin
my $config = $curproc->{ config };
my $rules = $config->get_as_array_ref('admin_command_restrictions');
for my $rule (@$rules) {
- if ($rule eq 'reject') {
+ $is_auth = $obj->$rule($curproc, $args, $optargs);
+
+ # reject as soon as possible
+ if ($is_auth eq '__LAST__') {
+ Log("admin: rejected by $rule");
return 0;
}
-
- $is_auth = $obj->$rule($curproc, $args, $optargs);
- if ($is_auth) {
+ elsif ($is_auth) {
+ Log("admin: auth by $rule");
return $is_auth;
}
else {
- Log("admin: $rule fail");
+ Log("admin: not match rule=$rule"); # XXX debug. remove this.
}
}
}