summaryrefslogtreecommitdiff
path: root/fml/lib/FML
diff options
context:
space:
mode:
authorfukachan <fukachan>2003-02-03 12:25:58 +0000
committerfukachan <fukachan>2003-02-03 12:25:58 +0000
commit52905e4eb47df4e80ebf274af1824e1e5c1c8781 (patch)
tree3fdb6603e94aac0fb300a5b9d9e461e150ac533c /fml/lib/FML
parent19afce81a05f1345815b8074cf438f438dce9bc4 (diff)
downloadfml8-52905e4eb47df4e80ebf274af1824e1e5c1c8781.tar.gz
fml8-52905e4eb47df4e80ebf274af1824e1e5c1c8781.tar.bz2
fml8-52905e4eb47df4e80ebf274af1824e1e5c1c8781.zip
for hook, wrap main code by is_refused() condition such as:
unless ($curproc->is_refused()) { main code ...; }
Diffstat (limited to 'fml/lib/FML')
-rw-r--r--fml/lib/FML/Process/Command.pm49
-rw-r--r--fml/lib/FML/Process/Error.pm68
2 files changed, 61 insertions, 56 deletions
diff --git a/fml/lib/FML/Process/Command.pm b/fml/lib/FML/Process/Command.pm
index 28726578..8278d86e 100644
--- a/fml/lib/FML/Process/Command.pm
+++ b/fml/lib/FML/Process/Command.pm
@@ -3,7 +3,7 @@
# Copyright (C) 2000,2001,2002,2003 Ken'ichi Fukamachi
# All rights reserved.
#
-# $FML: Command.pm,v 1.79 2003/01/03 07:06:38 fukachan Exp $
+# $FML: Command.pm,v 1.80 2003/01/11 06:58:45 fukachan Exp $
#
package FML::Process::Command;
@@ -147,32 +147,35 @@ sub run
my ($curproc, $args) = @_;
my $pcb = $curproc->{ pcb };
- # permit_xxx() sets the error reason at "check_restriction" in pcb.
- if ($curproc->permit_command($args)) {
- $curproc->_evaluate_command_lines($args);
- }
- # XXX reject command use irrespective of requests from admins/users.
- # XXX rejection of admin use occurs in _evaluate_command_lines() not here.
- # XXX possible cases are from "system_accounts" or from a not member.
- else {
- # check the error reason by permit_command().
- my $reason = $pcb->get("check_restrictions", "deny_reason");
- if (defined($reason) && ($reason eq 'reject_system_accounts')) {
- $curproc->reply_message_nl("error.system_accounts",
- "deny request from system accounts");
+ unless ($curproc->is_refused()) {
+ # permit_xxx() sets the error reason at "check_restriction" in pcb.
+ if ($curproc->permit_command($args)) {
+ $curproc->_evaluate_command_lines($args);
}
+ # XXX reject command use irrespective of requests from admins/users.
+ # XXX rejection of admin use occurs in _evaluate_command_lines()
+ # XXX not here.
+ # XXX possible cases are from "system_accounts" or from a not member.
else {
- $curproc->reply_message_nl("error.not_member",
- "deny request from a not member");
- }
+ # check the error reason by permit_command().
+ my $reason = $pcb->get("check_restrictions", "deny_reason");
+ if (defined($reason) && ($reason eq 'reject_system_accounts')) {
+ my $s = "deny request from system accounts";
+ $curproc->reply_message_nl("error.system_accounts", $s);
+ }
+ else {
+ $curproc->reply_message_nl("error.not_member",
+ "deny request from a not member");
+ }
- # append the incoming message into the error message sent back
- # as the reference.
- my $msg = $curproc->incoming_message();
- $curproc->reply_message( $msg );
+ # append the incoming message into the error message sent back
+ # as the reference.
+ my $msg = $curproc->incoming_message();
+ $curproc->reply_message( $msg );
- unless (defined $reason) { $reason = 'unknown';}
- Log("deny command. reason=$reason");
+ unless (defined $reason) { $reason = 'unknown';}
+ Log("deny command. reason=$reason");
+ }
}
}
diff --git a/fml/lib/FML/Process/Error.pm b/fml/lib/FML/Process/Error.pm
index 2af4d3f9..47a2c63a 100644
--- a/fml/lib/FML/Process/Error.pm
+++ b/fml/lib/FML/Process/Error.pm
@@ -3,7 +3,7 @@
# Copyright (C) 2002 Ken'ichi Fukamachi
# All rights reserved.
#
-# $FML: Error.pm,v 1.24 2002/09/22 15:01:21 fukachan Exp $
+# $FML: Error.pm,v 1.25 2002/12/22 03:46:20 fukachan Exp $
#
package FML::Process::Error;
@@ -146,40 +146,42 @@ sub run
my $eval = $config->get_hook( 'error_run_start_hook' );
if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; }
- eval q{
- use Mail::Bounce;
- my $bouncer = new Mail::Bounce;
- $bouncer->analyze( $msg );
-
- use FML::Error::Cache;
- my $errorcache = new FML::Error::Cache $curproc;
-
- for my $address ( $bouncer->address_list ) {
- my $status = $bouncer->status( $address );
- my $reason = $bouncer->reason( $address );
-
- if ($address) {
- Log("bounced: address=<$address>");
- Log("bounced: status=$status");
- Log("bounced: reason=\"$reason\"");
-
- $curproc->lock('errorcache');
- $errorcache->add({
- address => $address,
- status => $status,
- reason => $reason,
- });
- $curproc->unlock('errorcache');
-
- $found++;
+ unless ($curproc->is_refused()) {
+ eval q{
+ use Mail::Bounce;
+ my $bouncer = new Mail::Bounce;
+ $bouncer->analyze( $msg );
+
+ use FML::Error::Cache;
+ my $errorcache = new FML::Error::Cache $curproc;
+
+ for my $address ( $bouncer->address_list ) {
+ my $status = $bouncer->status( $address );
+ my $reason = $bouncer->reason( $address );
+
+ if ($address) {
+ Log("bounced: address=<$address>");
+ Log("bounced: status=$status");
+ Log("bounced: reason=\"$reason\"");
+
+ $curproc->lock('errorcache');
+ $errorcache->add({
+ address => $address,
+ status => $status,
+ reason => $reason,
+ });
+ $curproc->unlock('errorcache');
+
+ $found++;
+ }
}
- }
- };
- LogError($@) if $@;
+ };
+ LogError($@) if $@;
- if ($found) {
- $pcb->set("error", "found", 1);
- $curproc->_clean_up_bouncers($args);
+ if ($found) {
+ $pcb->set("error", "found", 1);
+ $curproc->_clean_up_bouncers($args);
+ }
}
$eval = $config->get_hook( 'error_run_end_hook' );