line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::MtPolicyd::Plugin::Eval; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1090
|
use Moose; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
4
|
1
|
|
|
1
|
|
4194
|
use namespace::autoclean; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
9
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '2.01'; # VERSION |
7
|
|
|
|
|
|
|
# ABSTRACT: mtpolicyd plugin to capture the output of plugins |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
extends 'Mail::MtPolicyd::Plugin'; |
11
|
|
|
|
|
|
|
with 'Mail::MtPolicyd::Plugin::Role::PluginChain'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has 'store_in' => ( is => 'ro', isa => 'Str', required => 1 ); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub run { |
16
|
0
|
|
|
0
|
1
|
|
my ( $self, $r ) = @_; |
17
|
0
|
|
|
|
|
|
my $field = $self->store_in; |
18
|
|
|
|
|
|
|
|
19
|
0
|
0
|
|
|
|
|
if( ! defined $self->chain ) { |
20
|
0
|
|
|
|
|
|
return; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
my $chain_result = $self->chain->run( $r ); |
24
|
0
|
|
|
|
|
|
my @actions = $chain_result->actions; |
25
|
|
|
|
|
|
|
|
26
|
0
|
0
|
|
|
|
|
if( scalar @actions ) { |
27
|
0
|
|
|
|
|
|
$r->session->{$field} = join("\n", @actions) |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
return; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=pod |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=encoding UTF-8 |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 NAME |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Mail::MtPolicyd::Plugin::Eval - mtpolicyd plugin to capture the output of plugins |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 VERSION |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
version 2.01 |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 DESCRIPTION |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
This plugin executes a list of configured plugins but will not return the |
54
|
|
|
|
|
|
|
action back to mtpolicyd. Instead it writes the output of the plugins to a |
55
|
|
|
|
|
|
|
variable within the session. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 PARAMETERS |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=over |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=item store_in (required) |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
The name of the key in the session to store the result of the eval'ed checks. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=item Plugin (required) |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
A list of checks to execute. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=back |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 EXAMPLE |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
<Plugin eval-spf> |
74
|
|
|
|
|
|
|
module = "Eval" |
75
|
|
|
|
|
|
|
# store result in spf_action |
76
|
|
|
|
|
|
|
store_in="spf_action" |
77
|
|
|
|
|
|
|
<Plugin proxy-spf> |
78
|
|
|
|
|
|
|
module = "Proxy" |
79
|
|
|
|
|
|
|
host = "localhost:10023" |
80
|
|
|
|
|
|
|
</Plugin> |
81
|
|
|
|
|
|
|
</Plugin> |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 AUTHOR |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Markus Benning <ich@markusbenning.de> |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This software is Copyright (c) 2014 by Markus Benning <ich@markusbenning.de>. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This is free software, licensed under: |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
The GNU General Public License, Version 2, June 1991 |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |