| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Mail::OpenRelay::Simple; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
28966
|
use 5.008; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
57
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
34
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
7
|
|
|
|
1
|
|
|
|
|
50
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use base qw(Class::Accessor::Fast); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
975
|
|
|
7
|
1
|
|
|
1
|
|
3403
|
use Carp; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
96
|
|
|
8
|
1
|
|
|
1
|
|
1721
|
use Net::Telnet; |
|
|
1
|
|
|
|
|
64355
|
|
|
|
1
|
|
|
|
|
558
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
|
11
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors( qw(host port timeout from_email rcpt_email banner debug)); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
$| = 1; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub check { |
|
18
|
|
|
|
|
|
|
|
|
19
|
1
|
|
|
1
|
1
|
43
|
my $self = shift; |
|
20
|
1
|
|
|
|
|
6
|
my $host = $self->host; |
|
21
|
1
|
|
|
|
|
15
|
my $port = $self->port; |
|
22
|
1
|
|
|
|
|
8
|
my $timeout = $self->timeout; |
|
23
|
1
|
|
|
|
|
7
|
my $from_email = $self->from_email; |
|
24
|
1
|
|
|
|
|
8
|
my $rcpt_email = $self->rcpt_email; |
|
25
|
1
|
|
|
|
|
8
|
my $banner = $self->banner; |
|
26
|
1
|
|
|
|
|
8
|
my $debug = $self->debug; |
|
27
|
|
|
|
|
|
|
|
|
28
|
1
|
50
|
|
|
|
7
|
$banner = $banner ? $banner : 0; |
|
29
|
1
|
50
|
|
|
|
3
|
$debug = $debug ? $debug : 0; |
|
30
|
1
|
50
|
|
|
|
3
|
$from_email = $from_email ? $from_email : "test\@foobar.com"; |
|
31
|
1
|
50
|
|
|
|
4
|
$rcpt_email = $rcpt_email ? $rcpt_email : "test\@foobar.com"; |
|
32
|
|
|
|
|
|
|
|
|
33
|
1
|
50
|
|
|
|
4
|
print ". Try to connect to $host...\n" if $debug == 2; |
|
34
|
|
|
|
|
|
|
|
|
35
|
1
|
|
50
|
|
|
15
|
my $t = new Net::Telnet( |
|
|
|
|
50
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Host => $host, |
|
37
|
|
|
|
|
|
|
Port => $port || '25', |
|
38
|
|
|
|
|
|
|
Timeout => $timeout || '8', |
|
39
|
|
|
|
|
|
|
Errmode => "return" |
|
40
|
|
|
|
|
|
|
); |
|
41
|
|
|
|
|
|
|
|
|
42
|
1
|
50
|
|
|
|
843
|
if ($t){ |
|
43
|
0
|
|
|
|
|
0
|
my $match = $t->getline; |
|
44
|
|
|
|
|
|
|
|
|
45
|
0
|
0
|
|
|
|
0
|
if ($match){ |
|
46
|
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
0
|
my $Banner = $match; |
|
48
|
0
|
|
|
|
|
0
|
chomp $Banner; for ($Banner) { s/^220\s//; } |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
49
|
|
|
|
|
|
|
|
|
50
|
0
|
0
|
|
|
|
0
|
if ($match =~ m/^220/){ |
|
51
|
|
|
|
|
|
|
|
|
52
|
0
|
0
|
|
|
|
0
|
print ". HELO foo\n" if $debug == 1; |
|
53
|
0
|
|
|
|
|
0
|
$t->print("HELO foo"); |
|
54
|
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
0
|
$match = $t->getline; |
|
56
|
0
|
0
|
|
|
|
0
|
if ($match){ |
|
57
|
0
|
0
|
|
|
|
0
|
if ($match =~ /^250/){ |
|
58
|
|
|
|
|
|
|
|
|
59
|
0
|
0
|
|
|
|
0
|
print ". MAIL FROM:<$from_email>\n" if $debug == 1; |
|
60
|
0
|
|
|
|
|
0
|
$t->print("MAIL FROM:<$from_email>"); |
|
61
|
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
0
|
$match = $t->getline; |
|
63
|
|
|
|
|
|
|
|
|
64
|
0
|
0
|
|
|
|
0
|
if ($match){ |
|
65
|
0
|
0
|
|
|
|
0
|
if ($match =~ /^250/){ |
|
66
|
|
|
|
|
|
|
|
|
67
|
0
|
0
|
|
|
|
0
|
print ". RCPT TO:<$rcpt_email>\n" if $debug == 1; |
|
68
|
0
|
|
|
|
|
0
|
$t->print("RCPT TO:<$rcpt_email>"); |
|
69
|
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
0
|
$match = $t->getline; |
|
71
|
|
|
|
|
|
|
|
|
72
|
0
|
0
|
|
|
|
0
|
if ($match){ |
|
73
|
0
|
0
|
|
|
|
0
|
if ($match =~ /^250/){ |
|
74
|
0
|
0
|
|
|
|
0
|
print "$Banner\n" if $banner == 1; |
|
75
|
0
|
|
|
|
|
0
|
return 1; |
|
76
|
|
|
|
|
|
|
} else { |
|
77
|
0
|
|
|
|
|
0
|
return 0; |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
} else { |
|
80
|
0
|
0
|
|
|
|
0
|
print ". can't send email with $host!\n" if $debug == 1; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
} |
|
88
|
0
|
|
|
|
|
0
|
$t->close; |
|
89
|
|
|
|
|
|
|
} else { |
|
90
|
1
|
50
|
|
|
|
4
|
print ". can't connect to host $host on port $port\n" if $debug == 1; |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
1
|
|
|
|
|
2
|
return; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
1; |
|
97
|
|
|
|
|
|
|
__END__ |