summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-08-26 12:57:05 +0000
committerfukachan <fukachan>2001-08-26 12:57:05 +0000
commit334389fad84ef640978dd5c7e07e167b96e26c74 (patch)
tree8b6f1d786401ca87b1f45675863112b3c672d8c4
parent20ad71392bcc3a4103d201d663ad9b2ebec36fb7 (diff)
downloadfml8-334389fad84ef640978dd5c7e07e167b96e26c74.tar.gz
fml8-334389fad84ef640978dd5c7e07e167b96e26c74.tar.bz2
fml8-334389fad84ef640978dd5c7e07e167b96e26c74.zip
implement has_address_in_map() method and is_member() uses this.
has_address_in_map() searches the address in the specified map.
-rw-r--r--fml/lib/FML/Credential.pm48
1 files changed, 33 insertions, 15 deletions
diff --git a/fml/lib/FML/Credential.pm b/fml/lib/FML/Credential.pm
index d7921ebf..16c7a752 100644
--- a/fml/lib/FML/Credential.pm
+++ b/fml/lib/FML/Credential.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: Credential.pm,v 1.11 2001/05/29 16:21:15 fukachan Exp $
+# $FML: Credential.pm,v 1.12 2001/06/29 05:57:32 fukachan Exp $
#
package FML::Credential;
@@ -14,7 +14,6 @@ use vars qw(%Credential @ISA @EXPORT @EXPORT_OK);
use Carp;
use ErrorStatus qw(errstr error error_set error_clear);
-
=head1 NAME
FML::Credential - authenticate the mail sender
@@ -119,21 +118,39 @@ sub is_member
MAP:
for my $map (split(/\s+/, $member_maps)) {
- if ($map) {
- my $obj = new IO::Adapter $map;
+ if (defined $map) {
+ $status = $self->has_address_in_map($map, $address);
+ last MAP if $status;
+ }
+ }
+
+ return $status; # found if ($status == 1).
+}
+
+
+sub has_address_in_map
+{
+ my ($self, $map, $address) = @_;
+ my $status = 0;
- # 1. get all entries match /^$user/ from $map.
- my $addrs = $obj->find( $user , { all => 1 });
+ my ($user, $domain) = split(/\@/, $address);
- # 2. try each address in the result matches $address to check.
- for my $x (@$addrs) {
- my ($r) = split(/\s+/, $x);
+ use IO::Adapter;
+ my $obj = new IO::Adapter $map;
- # 3. is_same_address() conceals matching algorithm details.
- if ($self->is_same_address($r, $address)) {
- $status = 1; # found
- last MAP;
- }
+ # 1. get all entries match /^$user/ from $map.
+ my $addrs = $obj->find( $user , { all => 1 });
+
+ # 2. try each address in the result matches $address to check.
+ if (defined $addrs) {
+ LOOP:
+ for my $x (@$addrs) {
+ my ($r) = split(/\s+/, $x);
+
+ # 3. is_same_address() conceals matching algorithm details.
+ if ($self->is_same_address($r, $address)) {
+ $status = 1; # found
+ last LOOP;
}
}
}
@@ -142,10 +159,11 @@ sub is_member
$self->error_set("user=$user domain=$domain not found");
}
- $status;
+ return $status;
}
+
=head2 C<match_system_accounts($curproc, $args)>
C<sender> ( == $self->sender() ) matches a system account or not.