line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Haineko::SMTPD::Greeting; |
2
|
3
|
|
|
3
|
|
3009
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
103
|
|
3
|
3
|
|
|
3
|
|
13
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
73
|
|
4
|
3
|
|
|
3
|
|
801
|
use Class::Accessor::Lite; |
|
3
|
|
|
|
|
1112
|
|
|
3
|
|
|
|
|
22
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
my $rwaccessors = [ |
7
|
|
|
|
|
|
|
'dsn', # (Integer) Support DSN or not |
8
|
|
|
|
|
|
|
'size', # (Integer) Max message size |
9
|
|
|
|
|
|
|
'auth', # (Integer) Support SMTP-AUTH |
10
|
|
|
|
|
|
|
'mechanism', # (ArrayRef) SMTP-AUTH Mechanisms |
11
|
|
|
|
|
|
|
'feature', # (ArrayRef) Greeting message lines |
12
|
|
|
|
|
|
|
'greeting', # (String) The first line of EHLO response |
13
|
|
|
|
|
|
|
'starttls', # (Integer) STARTTLS suppored or not |
14
|
|
|
|
|
|
|
'pipelining' # (Integer) PIPELINING supported or not |
15
|
|
|
|
|
|
|
]; |
16
|
|
|
|
|
|
|
my $roaccessors = []; |
17
|
|
|
|
|
|
|
my $woaccessors = []; |
18
|
|
|
|
|
|
|
Class::Accessor::Lite->mk_accessors( @$rwaccessors ); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
2
|
|
|
2
|
1
|
2541
|
my $class = shift; |
22
|
2
|
|
|
|
|
8
|
my $greet = [ @_ ]; |
23
|
2
|
|
|
|
|
18
|
my $feats = { |
24
|
|
|
|
|
|
|
'dsn' => undef, |
25
|
|
|
|
|
|
|
'size' => undef, |
26
|
|
|
|
|
|
|
'auth' => undef, |
27
|
|
|
|
|
|
|
'feature' => [], |
28
|
|
|
|
|
|
|
'starttls' => undef, |
29
|
|
|
|
|
|
|
'greeting' => q(), |
30
|
|
|
|
|
|
|
'mechanism' => [], |
31
|
|
|
|
|
|
|
'pipelining' => undef, |
32
|
|
|
|
|
|
|
}; |
33
|
|
|
|
|
|
|
|
34
|
2
|
|
|
|
|
5
|
$feats->{'greeting'} = shift @$greet; |
35
|
2
|
|
|
|
|
7
|
chomp $feats->{'greeting'}; |
36
|
|
|
|
|
|
|
|
37
|
2
|
|
|
|
|
6
|
for my $e ( @$greet ) { |
38
|
18
|
|
|
|
|
23
|
chomp $e; |
39
|
|
|
|
|
|
|
|
40
|
18
|
100
|
|
|
|
101
|
if( $e =~ /SIZE (?\d+)/ ) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# 250-SIZE 26214400 |
42
|
3
|
|
|
3
|
|
3633
|
$feats->{'size'} = int $+{'SIZE'}; |
|
3
|
|
|
|
|
1737
|
|
|
3
|
|
|
|
|
790
|
|
|
2
|
|
|
|
|
25
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
} elsif( $e =~ /AUTH (?.+)\z/ ) { |
45
|
|
|
|
|
|
|
# 250-AUTH LOGIN PLAIN CRAM-MD5 |
46
|
2
|
|
|
|
|
4
|
$feats->{'auth'} = 1; |
47
|
2
|
|
|
|
|
17
|
$feats->{'mechanism'} = [ split( ' ', $+{'MECHS'} ) ]; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
} elsif( $e =~ /PIPELINING/ ) { |
50
|
|
|
|
|
|
|
# 250-PIPELINING |
51
|
2
|
|
|
|
|
4
|
$feats->{'pipelining'} = 1; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
} elsif( $e =~ /STARTTLS/ ) { |
54
|
|
|
|
|
|
|
# 250-STARTTLS |
55
|
0
|
|
|
|
|
0
|
$feats->{'starttls'} = 1; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
} elsif( $e =~ /DSN/ ) { |
58
|
|
|
|
|
|
|
# 250-DSN |
59
|
2
|
|
|
|
|
4
|
$feats->{'dsn'} = 1; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
18
|
|
|
|
|
20
|
push @{ $feats->{'feature'} }, $e; |
|
18
|
|
|
|
|
43
|
|
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
2
|
|
|
|
|
11
|
return bless $feats, __PACKAGE__; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub mechs { |
69
|
3
|
|
|
3
|
1
|
4415
|
my $self = shift; |
70
|
3
|
|
100
|
|
|
12
|
my $mech = shift || return 0; |
71
|
|
|
|
|
|
|
|
72
|
2
|
100
|
|
|
|
4
|
return 1 if grep { uc $mech eq $_ } @{ $self->{'mechanism'} }; |
|
6
|
|
|
|
|
22
|
|
|
2
|
|
|
|
|
7
|
|
73
|
1
|
|
|
|
|
5
|
return 0; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |
77
|
|
|
|
|
|
|
__END__ |