diff options
| author | fukachan <fukachan> | 2003-05-12 10:16:38 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2003-05-12 10:16:38 +0000 |
| commit | f914afdbe83507cccca18b7953c3992aa18abc6e (patch) | |
| tree | 180a0aded945a705945a8a474e8c377f35c2ffb4 /fml/lib/FML/Command | |
| parent | b8e34c6b65bd5e1b5838204265e35845306a6f19 (diff) | |
| download | fml8-f914afdbe83507cccca18b7953c3992aa18abc6e.tar.gz fml8-f914afdbe83507cccca18b7953c3992aa18abc6e.tar.bz2 fml8-f914afdbe83507cccca18b7953c3992aa18abc6e.zip | |
we should operate only $primary_*_map not $*_maps in deleting the user
address.
Diffstat (limited to 'fml/lib/FML/Command')
| -rw-r--r-- | fml/lib/FML/Command/Admin/chaddr.pm | 26 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/changepassword.pm | 20 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/deladmin.pm | 32 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/delmoderator.pm | 32 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/digest.pm | 33 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/off.pm | 18 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/on.pm | 4 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/unsubscribe.pm | 24 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Auth.pm | 42 |
9 files changed, 99 insertions, 132 deletions
diff --git a/fml/lib/FML/Command/Admin/chaddr.pm b/fml/lib/FML/Command/Admin/chaddr.pm index 2d5bbe06..42eb8fa5 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.14 2003/03/17 13:22:24 fukachan Exp $ +# $FML: chaddr.pm,v 1.15 2003/03/18 10:42:42 fukachan Exp $ # package FML::Command::Admin::chaddr; @@ -69,12 +69,12 @@ sub lock_channel { return 'command_serialize';} sub process { my ($self, $curproc, $command_args) = @_; - my $config = $curproc->{ config }; - my $member_maps = $config->get_as_array_ref( 'member_maps' ); - my $recipient_maps = $config->get_as_array_ref( 'recipient_maps' ); - my $options = $command_args->{ options }; - my $old_address = ''; - my $new_address = ''; + my $config = $curproc->{ config }; + my $member_map = $config->{ 'primary_member_map' }; + my $recipient_map = $config->{ 'primary_recipient_map' }; + my $options = $command_args->{ options }; + my $old_address = ''; + my $new_address = ''; if (defined $command_args->{ command_data }) { my $x = $command_args->{ command_data }; @@ -91,15 +91,11 @@ sub process unless ($old_address && $new_address) { croak("chaddr: invalid arguments"); } - croak("\$member_maps is not specified") unless $member_maps; - croak("\$recipient_maps is not specified") unless $recipient_maps; + croak("\$member_map not specified") unless $member_map; + croak("\$recipient_map not specified") unless $recipient_map; - # change all maps including this $address. - my (@maps) = (); - push(@maps, @$member_maps); - push(@maps, @$recipient_maps); - - # FML::Command::UserControl specific parameters + # uc_args = FML::Command::UserControl specific parameters + my (@maps) = ($member_map, $recipient_map); my $uc_args = { old_address => $old_address, new_address => $new_address, diff --git a/fml/lib/FML/Command/Admin/changepassword.pm b/fml/lib/FML/Command/Admin/changepassword.pm index a057bb61..5b900538 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.3 2003/03/17 13:23:22 fukachan Exp $ +# $FML: changepassword.pm,v 1.4 2003/03/18 10:42:42 fukachan Exp $ # package FML::Command::Admin::changepassword; @@ -67,11 +67,9 @@ sub lock_channel { return 'command_serialize';} sub process { my ($self, $curproc, $command_args) = @_; - my $config = $curproc->config(); - my $maps = $config->get_as_array_ref('admin_member_password_maps'); - my $pri_map = $config->{ primary_admin_member_password_map }; - my $myname = $curproc->myname(); - my $options = $command_args->{ options }; + my $config = $curproc->config(); + my $myname = $curproc->myname(); + my $options = $command_args->{ options }; # XXX The arguments differ for the cases. # 1. command mail: admin changepassword [$USER] $PASSWORD @@ -121,20 +119,18 @@ sub _change_password { my ($self, $curproc, $command_args, $address, $password) = @_; my $config = $curproc->config(); - my $maps = $config->get_as_array_ref('admin_member_password_maps'); my $pri_map = $config->{ primary_admin_member_password_map }; my $up_args = { - primary_map => $pri_map, - maplist => $maps, - address => $address, - password => $password, + map => $pri_map, + address => $address, + password => $password, }; my $r = ''; eval q{ use FML::Command::Auth; my $passwd = new FML::Command::Auth; - $passwd->change($curproc, $command_args, $up_args); + $passwd->change_password($curproc, $command_args, $up_args); }; if ($r = $@) { croak($r); diff --git a/fml/lib/FML/Command/Admin/deladmin.pm b/fml/lib/FML/Command/Admin/deladmin.pm index 00e36204..f8922e7e 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.8 2003/01/27 04:36:29 fukachan Exp $ +# $FML: deladmin.pm,v 1.9 2003/03/18 10:42:42 fukachan Exp $ # package FML::Command::Admin::deladmin; @@ -69,25 +69,21 @@ sub process my $config = $curproc->config(); # target maps - my $member_maps = $config->get_as_array_ref('admin_member_maps'); - my $recipient_maps = $config->get_as_array_ref('admin_recipient_maps'); - my $options = $command_args->{ options }; - my $address = $command_args->{ command_data } || $options->[ 0 ]; + my $member_map = $config->{ 'primary_admin_member_map' }; + my $recipient_map = $config->{ 'primary_admin_recipient_map' }; + my $options = $command_args->{ options }; + my $address = $command_args->{ command_data } || $options->[ 0 ]; # fundamental check - croak("address not undefined") unless defined $address; - croak("address not specified") unless $address; - croak("member_maps not undefined") unless defined $member_maps; - croak("member_maps not specified") unless $member_maps; - croak("recipient_maps not undefined") unless defined $recipient_maps; - croak("recipient_maps not specified") unless $recipient_maps; - - # maplist - my $maplist = []; - push(@$maplist, @$member_maps) if @$member_maps; - push(@$maplist, @$recipient_maps) if @$recipient_maps; - - # FML::Command::UserControl specific parameters + croak("address not undefined") unless defined $address; + croak("address not specified") unless $address; + croak("member_map not undefined") unless defined $member_map; + croak("member_map not specified") unless $member_map; + croak("recipient_map not undefined") unless defined $recipient_map; + croak("recipient_map not specified") unless $recipient_map; + + # $uc_args = FML::Command::UserControl specific parameters + my $maplist = [ $member_map, $recipient_map ]; my $uc_args = { address => $address, maplist => $maplist, diff --git a/fml/lib/FML/Command/Admin/delmoderator.pm b/fml/lib/FML/Command/Admin/delmoderator.pm index dbd72047..438b7165 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.7 2003/01/27 04:40:21 fukachan Exp $ +# $FML: delmoderator.pm,v 1.8 2003/03/18 10:42:42 fukachan Exp $ # package FML::Command::Admin::delmoderator; @@ -69,25 +69,21 @@ sub process my $config = $curproc->config(); # target maps - my $member_maps = $config->get_as_array_ref('moderator_member_maps'); - my $recipient_maps = $config->get_as_array_ref('moderator_recipient_maps'); - my $options = $command_args->{ options }; - my $address = $command_args->{ command_data } || $options->[ 0 ]; + my $member_map = $config->{ 'primary_moderator_member_map' }; + my $recipient_map = $config->{ 'primary_moderator_recipient_map' }; + my $options = $command_args->{ options }; + my $address = $command_args->{ command_data } || $options->[ 0 ]; # fundamental check - croak("address not undefined") unless defined $address; - croak("address not specified") unless $address; - croak("member_maps not undefined") unless defined $member_maps; - croak("member_maps not specified") unless $member_maps; - croak("recipient_maps not undefined") unless defined $recipient_maps; - croak("recipient_maps not specified") unless $recipient_maps; - - # maplist - my $maplist = []; - push(@$maplist, @$member_maps) if @$member_maps; - push(@$maplist, @$recipient_maps) if @$recipient_maps; - - # FML::Command::UserControl specific parameters + croak("address not undefined") unless defined $address; + croak("address not specified") unless $address; + croak("member_map not undefined") unless defined $member_map; + croak("member_map not specified") unless $member_map; + croak("recipient_map not undefined") unless defined $recipient_map; + croak("recipient_map not specified") unless $recipient_map; + + # $uc_args = FML::Command::UserControl specific parameters + my $maplist = [ $member_map, $recipient_map ]; my $uc_args = { address => $address, maplist => $maplist, diff --git a/fml/lib/FML/Command/Admin/digest.pm b/fml/lib/FML/Command/Admin/digest.pm index d5f4d8f1..062c5d3c 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.8 2003/02/13 14:06:13 fukachan Exp $ +# $FML: digest.pm,v 1.9 2003/03/18 10:42:42 fukachan Exp $ # package FML::Command::Admin::digest; @@ -77,17 +77,16 @@ sub process my $mode = $options->[ 1 ] || ''; # maps - my $primary_recipient_map = $config->{ primary_recipient_map }; + my $recipient_map = $config->{ primary_recipient_map }; my $recipient_maps = $config->get_as_array_ref('recipient_maps'); my $digest_recipient_map = $config->{ primary_digest_recipient_map }; my $digest_recipient_maps = $config->get_as_array_ref('digest_recipient_maps'); # fundamental check - croak("address not defined") unless defined $address; + croak("address not defined") unless defined $address; croak("address not specified") unless $address; - croak("primary_recipient_map not defined") - unless defined $primary_recipient_map; + croak("primary_recipient_map not defined") unless defined $recipient_map; croak("recipient_maps not defined") unless defined $recipient_maps; croak("digest_recipient_map not defined") unless defined $digest_recipient_map; @@ -95,9 +94,9 @@ sub process unless defined $digest_recipient_maps; my $digest_args = { - address => $address, - mode => $mode, - primary_recipient_map => $primary_recipient_map, + address => $address, + mode => $mode, + primary_recipient_map => $recipient_map, recipient_maps => $recipient_maps, primary_digest_recipient_map => $digest_recipient_map, digest_recipient_maps => $digest_recipient_maps, @@ -131,16 +130,13 @@ sub _digest_on { my ($self, $curproc, $command_args, $dargs) = @_; my $address = $dargs->{ address }; - my $mode = $dargs->{ mode }; - my $primary_recipient_map = $dargs->{ primary_recipient_map }; - my $recipient_maps = $dargs->{ recipient_maps }; + my $recipient_map = $dargs->{ primary_recipient_map }; my $digest_recipient_map = $dargs->{ primary_digest_recipient_map }; - my $digest_recipient_maps = $dargs->{ digest_recipient_maps }; - # move $address from normal $recipient_maps to $digest_recipient_maps + # move $address from normal $recipient_map to $digest_recipient_map my $uc_normal_args = { address => $address, - maplist => $recipient_maps, + maplist => [ $recipient_map ], }; my $uc_digest_args = { @@ -162,21 +158,18 @@ sub _digest_off { my ($self, $curproc, $command_args, $dargs) = @_; my $address = $dargs->{ address }; - my $mode = $dargs->{ mode }; - my $primary_recipient_map = $dargs->{ primary_recipient_map }; - my $recipient_maps = $dargs->{ recipient_maps }; + my $recipient_map = $dargs->{ primary_recipient_map }; my $digest_recipient_map = $dargs->{ primary_digest_recipient_map }; - my $digest_recipient_maps = $dargs->{ digest_recipient_maps }; # move $address from normal $digest_recipient_maps to $prmary_recipient_map my $uc_normal_args = { address => $address, - maplist => [ $primary_recipient_map ], + maplist => [ $recipient_map ], }; my $uc_digest_args = { address => $address, - maplist => $digest_recipient_maps, + maplist => [ $digest_recipient_map ], }; $self->_userdel($curproc, $command_args, $uc_digest_args); diff --git a/fml/lib/FML/Command/Admin/off.pm b/fml/lib/FML/Command/Admin/off.pm index 1feb77cb..5d93ffa8 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.8 2003/02/13 14:06:13 fukachan Exp $ +# $FML: off.pm,v 1.9 2003/03/18 10:42:43 fukachan Exp $ # package FML::Command::Admin::off; @@ -66,20 +66,20 @@ sub lock_channel { return 'command_serialize';} sub process { my ($self, $curproc, $command_args) = @_; - my $config = $curproc->config(); - my $recipient_maps = $config->get_as_array_ref( 'recipient_maps' ); - my $options = $command_args->{ options }; - my $address = $command_args->{ command_data } || $options->[ 0 ]; + my $config = $curproc->config(); + my $recipient_map = $config->{ 'primary_recipient_map' }; + my $options = $command_args->{ options }; + my $address = $command_args->{ command_data } || $options->[ 0 ]; # fundamental check - croak("address not defined") unless defined $address; - croak("address not specified") unless $address; - croak("\$recipient_maps not specified") unless @$recipient_maps; + croak("address not defined") unless defined $address; + croak("address not specified") unless $address; + croak("\$recipient_map not specified") unless $recipient_map; # FML::Command::UserControl specific parameters my $uc_args = { address => $address, - maplist => $recipient_maps, + maplist => [ $recipient_map ], }; my $r = ''; diff --git a/fml/lib/FML/Command/Admin/on.pm b/fml/lib/FML/Command/Admin/on.pm index 0b302375..6b59a566 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.7 2003/02/13 14:06:13 fukachan Exp $ +# $FML: on.pm,v 1.8 2003/03/18 10:42:43 fukachan Exp $ # package FML::Command::Admin::on; @@ -67,8 +67,6 @@ sub process { my ($self, $curproc, $command_args) = @_; my $config = $curproc->{ config }; - - # XXX-TODO: use of $primary_recipient_map is correct here? my $recipient_map = $config->{ primary_recipient_map }; my $options = $command_args->{ options }; my $address = $command_args->{ command_data } || $options->[ 0 ]; diff --git a/fml/lib/FML/Command/Admin/unsubscribe.pm b/fml/lib/FML/Command/Admin/unsubscribe.pm index f22ec45d..12b0b17c 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.21 2003/02/13 14:06:13 fukachan Exp $ +# $FML: unsubscribe.pm,v 1.22 2003/03/18 10:42:43 fukachan Exp $ # package FML::Command::Admin::unsubscribe; @@ -68,22 +68,20 @@ sub lock_channel { return 'command_serialize';} sub process { my ($self, $curproc, $command_args) = @_; - my $config = $curproc->{ config }; - my $member_maps = $config->get_as_array_ref( 'member_maps' ); - my $recipient_maps = $config->get_as_array_ref( 'recipient_maps' ); - my $options = $command_args->{ options }; - my $address = $command_args->{ command_data } || $options->[ 0 ]; + my $config = $curproc->{ config }; + my $member_map = $config->{ 'primary_member_map' }; + my $recipient_map = $config->{ 'primary_recipient_map' }; + my $options = $command_args->{ options }; + my $address = $command_args->{ command_data } || $options->[ 0 ]; # fundamental check - croak("address is not defined") unless defined $address; - croak("address is not specified") unless $address; - croak("member_maps is not specified") unless @$member_maps; - croak("recipient_maps is not specified") unless @$recipient_maps; + croak("address not defined") unless defined $address; + croak("address not specified") unless $address; + croak("member_map not specified") unless $member_map; + croak("recipient_map not specified") unless $recipient_map; # FML::Command::UserControl specific parameters - my $maplist = []; - push(@$maplist, @$recipient_maps); - push(@$maplist, @$member_maps); + my $maplist = [ $member_map, $recipient_map ]; my $uc_args = { address => $address, maplist => $maplist, diff --git a/fml/lib/FML/Command/Auth.pm b/fml/lib/FML/Command/Auth.pm index 492e6232..df833689 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.24 2003/03/18 10:42:41 fukachan Exp $ +# $FML: Auth.pm,v 1.25 2003/03/28 10:32:21 fukachan Exp $ # package FML::Command::Auth; @@ -216,8 +216,7 @@ sub check_admin_member_password sub change_password { my ($self, $curproc, $command_args, $up_args) = @_; - my $maplist = $up_args->{ maplist }; - my $pri_map = $up_args->{ primary_map }; + my $map = $up_args->{ map }; my $address = $up_args->{ address }; my $password = $up_args->{ password }; my $status = 0; @@ -229,36 +228,31 @@ sub change_password $curproc->lock($lock_channel); - # XXX delete entries for address among ALL MAPS. use IO::Adapter; - for my $map (@$maplist) { - my $obj = new IO::Adapter $map; - if (defined $obj) { - $obj->open(); - if ($obj->find( $address )) { - $obj->delete( $address ); - if ($obj->error()) { - LogError("cannot delete $address from=$map"); - } - else { - Log("delete $address from=$map"); - } + my $obj = new IO::Adapter $map; + if (defined $obj) { + $obj->open(); + + # delete + if ($obj->find( $address )) { + $obj->delete( $address ); + if ($obj->error()) { + LogError("cannot delete $address from=$map"); + } + else { + Log("delete $address from=$map"); } - $obj->close(); } - } - # XXX add password entry to ONLY primary map. o.k. ? - my $obj = new IO::Adapter $pri_map; - if (defined $obj) { - $obj->open(); + # add $obj->add( $address, [ $cp, "UNIX_CRYPT" ] ) && $status++; if ($obj->error()) { - LogError("cannot add $address to=$pri_map"); + LogError("cannot add $address to=$map"); } else { - Log("add password for $address to=$pri_map"); + Log("add password for $address to=$map"); } + $obj->close(); } |
