diff options
| author | fukachan <fukachan> | 2003-03-18 10:42:40 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2003-03-18 10:42:40 +0000 |
| commit | 3be0d18d4f3196fad45761c405bbfc2a3b71a82e (patch) | |
| tree | 659aad4273b9d4d502c4667c6a55d487867139f2 /fml | |
| parent | d381df5a5824e204f61d7279ee6b798aec81c200 (diff) | |
| download | fml8-3be0d18d4f3196fad45761c405bbfc2a3b71a82e.tar.gz fml8-3be0d18d4f3196fad45761c405bbfc2a3b71a82e.tar.bz2 fml8-3be0d18d4f3196fad45761c405bbfc2a3b71a82e.zip | |
remove giant lock and use fine granuality locks now.
Diffstat (limited to 'fml')
32 files changed, 313 insertions, 51 deletions
diff --git a/fml/lib/FML/Command.pm b/fml/lib/FML/Command.pm index c9bad1b4..b2fd14a5 100644 --- a/fml/lib/FML/Command.pm +++ b/fml/lib/FML/Command.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: Command.pm,v 1.36 2003/01/03 07:03:35 fukachan Exp $ +# $FML: Command.pm,v 1.37 2003/03/16 10:47:22 fukachan Exp $ # # XXX @@ -185,7 +185,8 @@ sub AUTOLOAD my $command = undef; eval qq{ use $pkg; \$command = new $pkg;}; unless ($@) { - my $need_lock = 1; # default. + my $need_lock = 0; # no lock by default. + my $lock_channel = 'command_serialize'; # we need to authenticate this ? if ($command->can('auth')) { @@ -208,12 +209,15 @@ sub AUTOLOAD $curproc->reply_message(" Please contact the maintainer\n"); } + if ($command->can('lock_channel')) { + $lock_channel = $command->lock_channel() || 'command_serialize'; + } + # run the actual process if ($command->can('process')) { - # XXX_LOCK_CHANNEL: default - $curproc->lock() if $need_lock; + $curproc->lock($lock_channel) if $need_lock; $command->process($curproc, $command_args); - $curproc->unlock() if $need_lock; + $curproc->unlock($lock_channel) if $need_lock; } else { LogError("${pkg} has no process method"); diff --git a/fml/lib/FML/Command/Admin/addadmin.pm b/fml/lib/FML/Command/Admin/addadmin.pm index f162a76d..90488f7c 100644 --- a/fml/lib/FML/Command/Admin/addadmin.pm +++ b/fml/lib/FML/Command/Admin/addadmin.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: addadmin.pm,v 1.8 2002/12/15 13:46:28 fukachan Exp $ +# $FML: addadmin.pm,v 1.9 2003/01/25 12:48:37 fukachan Exp $ # package FML::Command::Admin::addadmin; @@ -52,6 +52,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'command_serialize';} + + # Descriptions: addadmin a new user # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $member_map $recipient_map diff --git a/fml/lib/FML/Command/Admin/addmoderator.pm b/fml/lib/FML/Command/Admin/addmoderator.pm index b3c318e7..a2f3c33e 100644 --- a/fml/lib/FML/Command/Admin/addmoderator.pm +++ b/fml/lib/FML/Command/Admin/addmoderator.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: addmoderator.pm,v 1.3 2002/09/22 14:56:44 fukachan Exp $ +# $FML: addmoderator.pm,v 1.4 2003/01/25 12:48:37 fukachan Exp $ # package FML::Command::Admin::addmoderator; @@ -52,6 +52,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'command_serialize';} + + # Descriptions: addmoderator a new user # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $member_map $recipient_map diff --git a/fml/lib/FML/Command/Admin/chaddr.pm b/fml/lib/FML/Command/Admin/chaddr.pm index 771989c5..2d5bbe06 100644 --- a/fml/lib/FML/Command/Admin/chaddr.pm +++ b/fml/lib/FML/Command/Admin/chaddr.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: chaddr.pm,v 1.13 2003/02/09 12:31:41 fukachan Exp $ +# $FML: chaddr.pm,v 1.14 2003/03/17 13:22:24 fukachan Exp $ # package FML::Command::Admin::chaddr; @@ -55,6 +55,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'command_serialize';} + + # Descriptions: change address from old one to new one # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $member_map $recipient_map diff --git a/fml/lib/FML/Command/Admin/changepassword.pm b/fml/lib/FML/Command/Admin/changepassword.pm index 21da2a46..a057bb61 100644 --- a/fml/lib/FML/Command/Admin/changepassword.pm +++ b/fml/lib/FML/Command/Admin/changepassword.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: changepassword.pm,v 1.2 2003/02/09 12:31:41 fukachan Exp $ +# $FML: changepassword.pm,v 1.3 2003/03/17 13:23:22 fukachan Exp $ # package FML::Command::Admin::changepassword; @@ -53,6 +53,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'command_serialize';} + + # Descriptions: change the admin password. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $member_map $recipient_map @@ -117,9 +124,10 @@ sub _change_password my $maps = $config->get_as_array_ref('admin_member_password_maps'); my $pri_map = $config->{ primary_admin_member_password_map }; my $up_args = { - maplist => $maps, - address => $address, - password => $password, + primary_map => $pri_map, + maplist => $maps, + address => $address, + password => $password, }; my $r = ''; diff --git a/fml/lib/FML/Command/Admin/deladmin.pm b/fml/lib/FML/Command/Admin/deladmin.pm index 57dbb6e7..00e36204 100644 --- a/fml/lib/FML/Command/Admin/deladmin.pm +++ b/fml/lib/FML/Command/Admin/deladmin.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: deladmin.pm,v 1.10 2003/01/26 03:15:10 fukachan Exp $ +# $FML: deladmin.pm,v 1.8 2003/01/27 04:36:29 fukachan Exp $ # package FML::Command::Admin::deladmin; @@ -52,6 +52,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'command_serialize';} + + # Descriptions: remove the specified administrator # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $member_map $recipient_map diff --git a/fml/lib/FML/Command/Admin/delmoderator.pm b/fml/lib/FML/Command/Admin/delmoderator.pm index 784ae222..dbd72047 100644 --- a/fml/lib/FML/Command/Admin/delmoderator.pm +++ b/fml/lib/FML/Command/Admin/delmoderator.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: delmoderator.pm,v 1.8 2003/01/27 04:36:29 fukachan Exp $ +# $FML: delmoderator.pm,v 1.7 2003/01/27 04:40:21 fukachan Exp $ # package FML::Command::Admin::delmoderator; @@ -52,6 +52,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'command_serialize';} + + # Descriptions: remove the specified moderator # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $member_map $recipient_map diff --git a/fml/lib/FML/Command/Admin/digest.pm b/fml/lib/FML/Command/Admin/digest.pm index 2cc8e6c0..d5f4d8f1 100644 --- a/fml/lib/FML/Command/Admin/digest.pm +++ b/fml/lib/FML/Command/Admin/digest.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: digest.pm,v 1.7 2003/02/09 12:31:41 fukachan Exp $ +# $FML: digest.pm,v 1.8 2003/02/13 14:06:13 fukachan Exp $ # package FML::Command::Admin::digest; @@ -57,6 +57,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'command_serialize';} + + # Descriptions: toggle delivery mode between real time and digest. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $recipient_map,$digest_recipient_maps diff --git a/fml/lib/FML/Command/Admin/digestoff.pm b/fml/lib/FML/Command/Admin/digestoff.pm index aca80df4..35e4708a 100644 --- a/fml/lib/FML/Command/Admin/digestoff.pm +++ b/fml/lib/FML/Command/Admin/digestoff.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: digestoff.pm,v 1.2 2002/12/15 13:46:28 fukachan Exp $ +# $FML: digestoff.pm,v 1.3 2003/01/25 12:48:38 fukachan Exp $ # package FML::Command::Admin::digestoff; @@ -52,6 +52,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'command_serialize';} + + # Descriptions: disable digest mode for the specified user. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $recipient_map,$digest_recipient_maps diff --git a/fml/lib/FML/Command/Admin/digeston.pm b/fml/lib/FML/Command/Admin/digeston.pm index 5a5a228a..fe57a5db 100644 --- a/fml/lib/FML/Command/Admin/digeston.pm +++ b/fml/lib/FML/Command/Admin/digeston.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: digeston.pm,v 1.2 2002/12/15 13:46:29 fukachan Exp $ +# $FML: digeston.pm,v 1.3 2003/01/25 12:48:38 fukachan Exp $ # package FML::Command::Admin::digeston; @@ -52,6 +52,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'command_serialize';} + + # Descriptions: digest mode off/on for the specified user. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $recipient_map,$digest_recipient_maps diff --git a/fml/lib/FML/Command/Admin/error.pm b/fml/lib/FML/Command/Admin/error.pm index 39184c12..76e0f36b 100644 --- a/fml/lib/FML/Command/Admin/error.pm +++ b/fml/lib/FML/Command/Admin/error.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: error.pm,v 1.1 2003/03/14 12:49:47 fukachan Exp $ +# $FML: error.pm,v 1.2 2003/03/14 14:17:59 fukachan Exp $ # package FML::Command::Admin::error; @@ -52,6 +52,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'error_analyzer_cache';} + + # Descriptions: change delivery mode from real time to digest. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $recipient_map diff --git a/fml/lib/FML/Command/Admin/file.pm b/fml/lib/FML/Command/Admin/file.pm index 64681e6d..b277cd62 100644 --- a/fml/lib/FML/Command/Admin/file.pm +++ b/fml/lib/FML/Command/Admin/file.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: file.pm,v 1.10 2003/01/25 09:14:05 fukachan Exp $ +# $FML: file.pm,v 1.11 2003/01/25 12:48:38 fukachan Exp $ # package FML::Command::Admin::file; @@ -52,6 +52,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'command_serialize';} + + # Descriptions: needs "command subcommand parameters" style or not # Arguments: none # Side Effects: none diff --git a/fml/lib/FML/Command/Admin/off.pm b/fml/lib/FML/Command/Admin/off.pm index cac0acb1..1feb77cb 100644 --- a/fml/lib/FML/Command/Admin/off.pm +++ b/fml/lib/FML/Command/Admin/off.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: off.pm,v 1.7 2003/02/13 13:34:26 fukachan Exp $ +# $FML: off.pm,v 1.8 2003/02/13 14:06:13 fukachan Exp $ # package FML::Command::Admin::off; @@ -52,6 +52,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'command_serialize';} + + # Descriptions: change delivery mode from real time to digest. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $recipient_map diff --git a/fml/lib/FML/Command/Admin/on.pm b/fml/lib/FML/Command/Admin/on.pm index 5efbdf1e..0b302375 100644 --- a/fml/lib/FML/Command/Admin/on.pm +++ b/fml/lib/FML/Command/Admin/on.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: on.pm,v 1.6 2003/01/25 12:48:39 fukachan Exp $ +# $FML: on.pm,v 1.7 2003/02/13 14:06:13 fukachan Exp $ # package FML::Command::Admin::on; @@ -52,6 +52,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'command_serialize';} + + # Descriptions: change delivery mode from digest to real time. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $recipient_map diff --git a/fml/lib/FML/Command/Admin/password.pm b/fml/lib/FML/Command/Admin/password.pm index 13bcdd63..a17fffea 100644 --- a/fml/lib/FML/Command/Admin/password.pm +++ b/fml/lib/FML/Command/Admin/password.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: password.pm,v 1.7 2003/02/09 12:31:42 fukachan Exp $ +# $FML: password.pm,v 1.8 2003/02/11 09:48:17 fukachan Exp $ # package FML::Command::Admin::password; @@ -52,6 +52,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'command_serialize';} + + # Descriptions: dummy in the case of command mail. # # [Case 1: command mail] diff --git a/fml/lib/FML/Command/Admin/spool.pm b/fml/lib/FML/Command/Admin/spool.pm index cf451499..f9604f4a 100644 --- a/fml/lib/FML/Command/Admin/spool.pm +++ b/fml/lib/FML/Command/Admin/spool.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: spool.pm,v 1.1 2003/03/15 09:07:04 fukachan Exp $ +# $FML: spool.pm,v 1.2 2003/03/16 10:56:00 fukachan Exp $ # package FML::Command::Admin::spool; @@ -49,7 +49,14 @@ sub new # Arguments: none # Side Effects: none # Return Value: NUM( 1 or 0) -sub need_lock { 0;} +sub need_lock { 1;} + + +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'article_spool_modify';} # Descriptions: subcommand dispatch table for "spool" command. diff --git a/fml/lib/FML/Command/Admin/subscribe.pm b/fml/lib/FML/Command/Admin/subscribe.pm index a5c5d55e..a6bee786 100644 --- a/fml/lib/FML/Command/Admin/subscribe.pm +++ b/fml/lib/FML/Command/Admin/subscribe.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: subscribe.pm,v 1.20 2003/01/25 12:48:39 fukachan Exp $ +# $FML: subscribe.pm,v 1.21 2003/02/13 14:06:13 fukachan Exp $ # package FML::Command::Admin::subscribe; @@ -54,6 +54,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'command_serialize';} + + # Descriptions: subscribe a new user. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $member_map $recipient_map diff --git a/fml/lib/FML/Command/Admin/summary.pm b/fml/lib/FML/Command/Admin/summary.pm index 11d7c078..3d3aa504 100644 --- a/fml/lib/FML/Command/Admin/summary.pm +++ b/fml/lib/FML/Command/Admin/summary.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: summary.pm,v 1.1 2003/03/14 03:44:16 fukachan Exp $ +# $FML: summary.pm,v 1.1 2003/03/14 12:13:04 fukachan Exp $ # package FML::Command::Admin::summary; @@ -52,6 +52,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'article_spool_modify';} + + # Descriptions: change delivery mode from real time to digest. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $recipient_map diff --git a/fml/lib/FML/Command/Admin/thread.pm b/fml/lib/FML/Command/Admin/thread.pm index 27735e0d..fce05c78 100644 --- a/fml/lib/FML/Command/Admin/thread.pm +++ b/fml/lib/FML/Command/Admin/thread.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: thread.pm,v 1.2 2003/03/14 06:53:22 fukachan Exp $ +# $FML: thread.pm,v 1.1 2003/03/16 04:53:33 fukachan Exp $ # package FML::Command::Admin::thread; @@ -53,6 +53,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'article_thread';} + + # Descriptions: change delivery mode from real time to digest. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $recipient_map diff --git a/fml/lib/FML/Command/Admin/unsubscribe.pm b/fml/lib/FML/Command/Admin/unsubscribe.pm index 44bdd545..f22ec45d 100644 --- a/fml/lib/FML/Command/Admin/unsubscribe.pm +++ b/fml/lib/FML/Command/Admin/unsubscribe.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: unsubscribe.pm,v 1.20 2003/01/29 13:32:31 fukachan Exp $ +# $FML: unsubscribe.pm,v 1.21 2003/02/13 14:06:13 fukachan Exp $ # package FML::Command::Admin::unsubscribe; @@ -54,6 +54,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'command_serialize';} + + # Descriptions: remove the specified user. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $member_map $recipient_map diff --git a/fml/lib/FML/Command/Auth.pm b/fml/lib/FML/Command/Auth.pm index 60b3d7e3..721696c9 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.22 2003/02/09 12:31:41 fukachan Exp $ +# $FML: Auth.pm,v 1.23 2003/03/17 13:24:33 fukachan Exp $ # package FML::Command::Auth; @@ -14,6 +14,10 @@ use Carp; use FML::Log qw(Log LogWarn LogError); +# XXX_LOCK_CHANNEL: auth_map_modify +my $lock_channel = "auth_map_modify"; + + =head1 NAME FML::Command::Auth - authentication functions @@ -129,6 +133,7 @@ sub check_admin_member_password my ($self, $curproc, $args, $optargs) = @_; my $config = $curproc->{ config }; my $maplist = $config->get_as_array_ref('admin_member_password_maps'); + my $status = 0; # simple sanity check: verify non empty input or not? return 0 unless $optargs->{ address }; @@ -148,6 +153,8 @@ sub check_admin_member_password use FML::Credential; my $cred = new FML::Credential $curproc; + $curproc->lock($lock_channel); + # search $user in password database map, which has a hash of # { $user => $encryptd_passwrod }. for my $map (@$maplist) { @@ -175,15 +182,18 @@ sub check_admin_member_password if ($debug) { Log("check_admin_member_password: password match"); } - return 1; + $status = 1; + last PASSWORD_ENTRY; } } } } } - LogWarn("check_admin_member_password: password not match"); - return 0; + $curproc->unlock($lock_channel); + + LogWarn("check_admin_member_password: password not match") unless $status; + return $status; } @@ -207,6 +217,7 @@ sub change_password { my ($self, $curproc, $command_args, $up_args) = @_; my $maplist = $up_args->{ maplist }; + my $pri_map = $up_args->{ primary_map }; my $address = $up_args->{ address }; my $password = $up_args->{ password }; my $status = 0; @@ -216,6 +227,8 @@ sub change_password my $crypt = new FML::Crypt; my $cp = $crypt->unix_crypt($password, $$); + $curproc->lock($lock_channel); + # XXX delete entries for address among ALL MAPS. use IO::Adapter; for my $map (@$maplist) { @@ -249,6 +262,8 @@ sub change_password $obj->close(); } + $curproc->unlock($lock_channel); + return $status; } diff --git a/fml/lib/FML/Command/User/chaddr.pm b/fml/lib/FML/Command/User/chaddr.pm index 7d7a532b..23c6d386 100644 --- a/fml/lib/FML/Command/User/chaddr.pm +++ b/fml/lib/FML/Command/User/chaddr.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: chaddr.pm,v 1.17 2003/02/01 05:27:52 fukachan Exp $ +# $FML: chaddr.pm,v 1.18 2003/02/01 06:08:38 fukachan Exp $ # package FML::Command::User::chaddr; @@ -58,6 +58,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'command_serialize';} + + # Descriptions: chaddr adapter: confirm before chaddr operation # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update database for confirmation. diff --git a/fml/lib/FML/Command/User/confirm.pm b/fml/lib/FML/Command/User/confirm.pm index 9d3c5c92..44d5ed66 100644 --- a/fml/lib/FML/Command/User/confirm.pm +++ b/fml/lib/FML/Command/User/confirm.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: confirm.pm,v 1.19 2002/12/24 10:19:45 fukachan Exp $ +# $FML: confirm.pm,v 1.20 2003/01/25 12:48:40 fukachan Exp $ # package FML::Command::User::confirm; @@ -52,6 +52,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'command_serialize';} + + # Descriptions: addresses to inform a message copy to # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: none diff --git a/fml/lib/FML/Command/User/digest.pm b/fml/lib/FML/Command/User/digest.pm index 344e641e..3d68888c 100644 --- a/fml/lib/FML/Command/User/digest.pm +++ b/fml/lib/FML/Command/User/digest.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: digest.pm,v 1.2 2002/12/23 14:45:01 fukachan Exp $ +# $FML: digest.pm,v 1.3 2002/12/24 10:19:45 fukachan Exp $ # package FML::Command::User::digest; @@ -53,6 +53,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'command_serialize';} + + # Descriptions: digest off/on adapter. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update database for confirmation. diff --git a/fml/lib/FML/Command/User/get.pm b/fml/lib/FML/Command/User/get.pm index ee68356c..17b5021b 100644 --- a/fml/lib/FML/Command/User/get.pm +++ b/fml/lib/FML/Command/User/get.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: get.pm,v 1.14 2002/12/18 04:22:37 fukachan Exp $ +# $FML: get.pm,v 1.15 2003/02/16 08:49:12 fukachan Exp $ # package FML::Command::User::get; @@ -55,6 +55,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'article_spool_modify';} + + # Descriptions: send articles (filename =~ /^\d+/$) by FML::Command::SendFile. # This module is called after # FML::Process::Command::_can_accpet_command() already checks the diff --git a/fml/lib/FML/Command/User/off.pm b/fml/lib/FML/Command/User/off.pm index 969a3ae2..672890ad 100644 --- a/fml/lib/FML/Command/User/off.pm +++ b/fml/lib/FML/Command/User/off.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: off.pm,v 1.5 2002/12/18 04:22:37 fukachan Exp $ +# $FML: off.pm,v 1.6 2002/12/24 10:19:45 fukachan Exp $ # package FML::Command::User::off; @@ -54,6 +54,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'command_serialize';} + + # Descriptions: change delivery mode from real time to digest # after confirmation succeeds. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) diff --git a/fml/lib/FML/Command/User/on.pm b/fml/lib/FML/Command/User/on.pm index 53723c1a..bfd7a3ff 100644 --- a/fml/lib/FML/Command/User/on.pm +++ b/fml/lib/FML/Command/User/on.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: on.pm,v 1.5 2002/12/18 04:22:37 fukachan Exp $ +# $FML: on.pm,v 1.6 2002/12/24 10:19:45 fukachan Exp $ # package FML::Command::User::on; @@ -54,6 +54,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'command_serialize';} + + # Descriptions: change delivery mode from digest to real time # after confirmation. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) diff --git a/fml/lib/FML/Command/User/subscribe.pm b/fml/lib/FML/Command/User/subscribe.pm index c4ca0d54..03118d5d 100644 --- a/fml/lib/FML/Command/User/subscribe.pm +++ b/fml/lib/FML/Command/User/subscribe.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: subscribe.pm,v 1.17 2003/02/01 05:27:52 fukachan Exp $ +# $FML: subscribe.pm,v 1.18 2003/02/01 06:08:38 fukachan Exp $ # package FML::Command::User::subscribe; @@ -54,6 +54,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'command_serialize';} + + # Descriptions: subscribe adapter. # we confirm it before real subscribe process. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) diff --git a/fml/lib/FML/Command/User/summary.pm b/fml/lib/FML/Command/User/summary.pm index 6313e8d7..c7e0beb8 100644 --- a/fml/lib/FML/Command/User/summary.pm +++ b/fml/lib/FML/Command/User/summary.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: summary.pm,v 1.11 2002/09/22 14:56:48 fukachan Exp $ +# $FML: summary.pm,v 1.12 2002/12/15 13:46:31 fukachan Exp $ # package FML::Command::User::summary; @@ -56,6 +56,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'article_spool_modify';} + + # Descriptions: send summary file by FML::Command::SendFile. # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: none diff --git a/fml/lib/FML/Command/User/unsubscribe.pm b/fml/lib/FML/Command/User/unsubscribe.pm index f56ce06a..fa3095bc 100644 --- a/fml/lib/FML/Command/User/unsubscribe.pm +++ b/fml/lib/FML/Command/User/unsubscribe.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: unsubscribe.pm,v 1.17 2003/02/01 05:27:52 fukachan Exp $ +# $FML: unsubscribe.pm,v 1.18 2003/02/01 06:08:38 fukachan Exp $ # package FML::Command::User::unsubscribe; @@ -54,6 +54,13 @@ sub new sub need_lock { 1;} +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'command_serialize';} + + # Descriptions: unsubscribe adapter: confirm before unsubscribe # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update database for confirmation. diff --git a/fml/lib/FML/Command/UserControl.pm b/fml/lib/FML/Command/UserControl.pm index 85b94eee..fc95b861 100644 --- a/fml/lib/FML/Command/UserControl.pm +++ b/fml/lib/FML/Command/UserControl.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: UserControl.pm,v 1.27 2003/02/15 02:25:40 fukachan Exp $ +# $FML: UserControl.pm,v 1.28 2003/03/17 13:27:15 fukachan Exp $ # package FML::Command::UserControl; @@ -17,6 +17,11 @@ use FML::Restriction::Base; use FML::Log qw(Log LogWarn LogError); use IO::Adapter; + +# XXX_LOCK_CHANNEL: recipient_map_modify +my $lock_channel = "recipient_map_modify"; + + # # XXX-TODO: we use this module to add/del user anywhere. # @@ -62,6 +67,7 @@ sub useradd my $address = $uc_args->{ address }; my $maplist = $uc_args->{ maplist }; my $trycount = 0; + my $reason = ''; # XXX check if $address is safe (persistent ?). my $safe = new FML::Restriction::Base; @@ -74,6 +80,10 @@ sub useradd $msg_args->{ _arg_address } = $address; my $ml_home_dir = $config->{ ml_home_dir }; + + $curproc->lock($lock_channel); + + MAP: for my $map (@$maplist) { my $_map = $map; $_map =~ s@$ml_home_dir@\$ml_home_dir@; @@ -102,15 +112,21 @@ sub useradd $curproc->reply_message_nl('command.add_fail', "failed to add $address", $msg_args); - croak("fail to add $address to map=$_map"); + $reason = "fail to add $address to map=$_map"; + last MAP; } } else { - croak( "$address is already member (map=$_map)" ); - return undef; + $reason = "$address is already member (map=$_map)"; + last MAP; } } + $curproc->unlock($lock_channel); + if ($reason) { + croak($reason); + } + unless ($trycount) { LogError("no trail to add $address"); } @@ -129,6 +145,7 @@ sub userdel my $address = $uc_args->{ address }; my $maplist = $uc_args->{ maplist }; my $trycount = 0; + my $reason = ''; # XXX check if $address is safe (persistent ?). my $safe = new FML::Restriction::Base; @@ -141,6 +158,10 @@ sub userdel $msg_args->{ _arg_address } = $address; my $ml_home_dir = $config->{ ml_home_dir }; + + $curproc->lock($lock_channel); + + MAP: for my $map (@$maplist) { my $_map = $map; $_map =~ s@$ml_home_dir@\$ml_home_dir@; @@ -172,7 +193,8 @@ sub userdel $curproc->reply_message_nl('command.del_fail', "failed to remove $address", $msg_args); - croak("fail to remove $address from map=$_map"); + $reason = "fail to remove $address from map=$_map"; + last MAP; } } else { @@ -180,6 +202,11 @@ sub userdel } } + $curproc->unlock($lock_channel); + if ($reason) { + croak($reason); + } + unless ($trycount) { LogError("no trail to remove $address"); } @@ -200,11 +227,15 @@ sub user_chaddr # save excursion: exatct match as could as possible. $cred->set_compare_level( 100 ); + $curproc->lock($lock_channel); + for my $map (@$maplist) { $self->_try_chaddr_in_map($curproc, $command_args, $uc_args, $cred, $map); } + $curproc->unlock($lock_channel); + # reset enironment. $cred->set_compare_level( $level ); } @@ -258,7 +289,7 @@ sub _try_chaddr_in_map Log("delete $old_address from map=$map"); } else { - croak("fail to delete $old_address to map=$map"); + LogError("fail to delete $old_address to map=$map"); } $obj->close(); } @@ -273,7 +304,7 @@ sub _try_chaddr_in_map Log("add $new_address to map=$map"); } else { - croak("fail to add $new_address to map=$map"); + LogError("fail to add $new_address to map=$map"); } $obj->close(); } @@ -294,6 +325,8 @@ sub userlist my $wh = $uc_args->{ wh }; my $style = $curproc->get_print_style(); + $curproc->lock($lock_channel); + for my $map (@$maplist) { my $obj = new IO::Adapter $map, $config; @@ -316,6 +349,8 @@ sub userlist LogWarn("canot open $map"); } } + + $curproc->unlock($lock_channel); } @@ -329,6 +364,8 @@ sub get_user_list my $config = $curproc->config(); my $r = []; + $curproc->lock($lock_channel); + for my $map (@$list) { my $io = new IO::Adapter $map, $config; my $key = ''; @@ -341,6 +378,8 @@ sub get_user_list } } + $curproc->unlock($lock_channel); + return $r; } diff --git a/fml/lib/FML/Process/Distribute.pm b/fml/lib/FML/Process/Distribute.pm index 7ac9c6a6..ec876b6e 100644 --- a/fml/lib/FML/Process/Distribute.pm +++ b/fml/lib/FML/Process/Distribute.pm @@ -3,7 +3,7 @@ # Copyright (C) 2000,2001,2002,2003 Ken'ichi Fukamachi # All rights reserved. # -# $FML: Distribute.pm,v 1.110 2003/03/16 10:49:51 fukachan Exp $ +# $FML: Distribute.pm,v 1.111 2003/03/17 09:01:17 fukachan Exp $ # package FML::Process::Distribute; @@ -201,7 +201,7 @@ sub run my $eval = $config->get_hook( 'distribute_run_start_hook' ); if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } - $curproc->lock(); # XXX_LOCK_CHANNEL: default + # $curproc->lock(); unless ($curproc->is_refused()) { if ($curproc->permit_post($args)) { $curproc->_distribute($args); @@ -249,7 +249,8 @@ sub run else { LogError("ignore this request."); } - $curproc->unlock(); + + # $curproc->unlock(); $eval = $config->get_hook( 'distribute_run_end_hook' ); if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; } @@ -422,6 +423,7 @@ sub _header_rewrite sub _deliver_article { my ($curproc, $args) = @_; + my $cred = $curproc->{ credential }; my $config = $curproc->{ config }; # FML::Config object my $message = $curproc->article_message(); # Mail::Message object my $header = $curproc->article_message_header(); # FML::Header object @@ -464,6 +466,9 @@ sub _deliver_article if ($service->error) { Log($service->error); return;} + # XXX_LOCK_CHANNEL: recipient_map_modify + my $lock_channel = "recipient_map_modify"; + $curproc->lock($lock_channel); $service->deliver( { 'smtp_servers' => $config->{'smtp_servers'}, @@ -476,6 +481,8 @@ sub _deliver_article map_params => $config, }); + $curproc->unlock($lock_channel); + if ($service->error) { Log($service->error); return;} } |
