summaryrefslogtreecommitdiff
path: root/fml/lib/FML/Command
diff options
context:
space:
mode:
authorfukachan <fukachan>2004-04-27 13:37:48 +0000
committerfukachan <fukachan>2004-04-27 13:37:48 +0000
commit400971bb0d9496c7dba3fbc4495b20bd23e68d5e (patch)
tree4c66417f824be1f4667ffc690f7c08a68c3f881c /fml/lib/FML/Command
parentfcc728319c9ce391254eb4f86abbc75cc217ed19 (diff)
downloadfml8-400971bb0d9496c7dba3fbc4495b20bd23e68d5e.tar.gz
fml8-400971bb0d9496c7dba3fbc4495b20bd23e68d5e.tar.bz2
fml8-400971bb0d9496c7dba3fbc4495b20bd23e68d5e.zip
bug fix search logic.
move quotemeta() from IO::Adapter to here.
Diffstat (limited to 'fml/lib/FML/Command')
-rw-r--r--fml/lib/FML/Command/Auth.pm29
1 files changed, 21 insertions, 8 deletions
diff --git a/fml/lib/FML/Command/Auth.pm b/fml/lib/FML/Command/Auth.pm
index 1d5f92b2..74654e81 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.35 2004/04/23 04:10:30 fukachan Exp $
+# $FML: Auth.pm,v 1.36 2004/04/23 13:45:15 fukachan Exp $
#
package FML::Command::Auth;
@@ -172,7 +172,8 @@ sub check_admin_member_password
for my $map (@$maplist) {
use IO::Adapter;
my $obj = new IO::Adapter $map, $config;
- my $pwent = $obj->find( $user , { want => 'key,value', all => 1 });
+ my $_user = quotemeta($user);
+ my $pwent = $obj->find($_user , { want => 'key,value', all => 1 });
# if this $map has this $user entry,
# try to check { user => password } relation.
@@ -240,6 +241,7 @@ sub check_admin_member_password
sub change_password
{
my ($self, $curproc, $command_args, $up_args) = @_;
+ my $cred = $curproc->{ credential };
my $map = $up_args->{ map };
my $address = $up_args->{ address };
my $password = $up_args->{ password };
@@ -259,13 +261,24 @@ sub change_password
$obj->touch();
# delete
- if ($obj->find( $address )) {
- $obj->delete( $address );
- if ($obj->error()) {
- $curproc->logerror("cannot delete $address from=$map");
+ my ($addrs) = $obj->find( $address, { all => 1 });
+ if (@$addrs) {
+ my $found = 0;
+ for my $a (@$addrs) {
+ my ($user, $pwd, $encode) = split(/\s+/, $a);
+ if ($cred->is_same_address($user, $address)) {
+ $found = 1;
+ }
}
- else {
- $curproc->log("delete $address from=$map");
+
+ if ($found) {
+ $obj->delete( $address );
+ if ($obj->error()) {
+ $curproc->logerror("cannot delete $address from=$map");
+ }
+ else {
+ $curproc->log("delete $address from=$map");
+ }
}
}
else {