summaryrefslogtreecommitdiff
path: root/fml/lib
diff options
context:
space:
mode:
authorfukachan <fukachan>2008-06-28 21:05:47 +0000
committerfukachan <fukachan>2008-06-28 21:05:47 +0000
commite1d2a9638cd6839464e824390e0136d4c12f76e2 (patch)
tree82e6be897476c0f11d7942b0be5c323641a1cd9b /fml/lib
parent9b98cc1a50a7911075e5c9b270472012b85d7182 (diff)
downloadfml8-e1d2a9638cd6839464e824390e0136d4c12f76e2.tar.gz
fml8-e1d2a9638cd6839464e824390e0136d4c12f76e2.tar.bz2
fml8-e1d2a9638cd6839464e824390e0136d4c12f76e2.zip
define permit_createonpost_newml_maps
Diffstat (limited to 'fml/lib')
-rw-r--r--fml/lib/FML/Restriction/CreateOnPost.pm46
1 files changed, 43 insertions, 3 deletions
diff --git a/fml/lib/FML/Restriction/CreateOnPost.pm b/fml/lib/FML/Restriction/CreateOnPost.pm
index 00775f1c..7436554b 100644
--- a/fml/lib/FML/Restriction/CreateOnPost.pm
+++ b/fml/lib/FML/Restriction/CreateOnPost.pm
@@ -1,10 +1,10 @@
#-*- perl -*-
#
-# Copyright (C) 2006 Ken'ichi Fukamachi
+# Copyright (C) 2006,2008 Ken'ichi Fukamachi
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: CreateOnPost.pm,v 1.2 2006/02/05 02:44:25 fukachan Exp $
+# $FML: CreateOnPost.pm,v 1.3 2006/07/09 12:11:13 fukachan Exp $
#
package FML::Restriction::CreateOnPost;
@@ -110,6 +110,46 @@ sub reject_list_header_field
}
+# Descriptions: permit if the sender is contained in $createonpost_newml_maps.
+# Arguments: OBJ($self) STR($rule) STR($sender)
+# Side Effects: none
+# Return Value: ARRAY(STR, STR)
+sub permit_createonpost_newml_maps
+{
+ my ($self, $rule, $sender) = @_;
+ my $curproc = $self->{ _curproc };
+ my $config = $curproc->config();
+ my $header = $curproc->incoming_message_header();
+ my $cred = $curproc->credential();
+ my $from = $header->address_cleanup( $header->get('from') );
+
+ my $maps = 'createonpost_newml_maps';
+ my $map_list = $config->get_as_array_ref($maps) || [];
+
+ # check if from: address is contained in either map.
+ my $status = 0;
+ MAP:
+ for my $map (@$map_list) {
+ if (defined $map) {
+ my $is_valid = $cred->is_valid_map($map, $config);
+ if ($is_valid) {
+ $status = $cred->has_address_in_map($map, $config, $from);
+ last MAP if $status;
+ }
+ else {
+ $curproc->logdebug("invalid map: $map");
+ }
+ }
+ }
+
+ if ($status) {
+ return("matched", "permit");
+ }
+
+ return(0, undef);
+}
+
+
=head1 CODING STYLE
See C<http://www.fml.org/software/FNF/> on fml coding style guide.
@@ -120,7 +160,7 @@ Ken'ichi Fukamachi
=head1 COPYRIGHT
-Copyright (C) 2006 Ken'ichi Fukamachi
+Copyright (C) 2006,2008 Ken'ichi Fukamachi
All rights reserved. This program is free software; you can
redistribute it and/or modify it under the same terms as Perl itself.