line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#############################################################################
|
2
|
|
|
|
|
|
|
## This file was generated automatically by Class::HPLOO/0.12
|
3
|
|
|
|
|
|
|
##
|
4
|
|
|
|
|
|
|
## Original file: ./lib/Mail/SendEasy/AUTH.hploo
|
5
|
|
|
|
|
|
|
## Generation date: 2004-04-09 04:49:29
|
6
|
|
|
|
|
|
|
##
|
7
|
|
|
|
|
|
|
## ** Do not change this file, use the original HPLOO source! **
|
8
|
|
|
|
|
|
|
#############################################################################
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#############################################################################
|
11
|
|
|
|
|
|
|
## Name: AUTH.pm
|
12
|
|
|
|
|
|
|
## Purpose: Mail::SendEasy::AUTH
|
13
|
|
|
|
|
|
|
## Author: Graciliano M. P.
|
14
|
|
|
|
|
|
|
## Modified by:
|
15
|
|
|
|
|
|
|
## Created: 2004-01-23
|
16
|
|
|
|
|
|
|
## RCS-ID:
|
17
|
|
|
|
|
|
|
## Copyright: (c) 2004 Graciliano M. P.
|
18
|
|
|
|
|
|
|
## Licence: This program is free software; you can redistribute it and/or
|
19
|
|
|
|
|
|
|
## modify it under the same terms as Perl itself
|
20
|
|
|
|
|
|
|
#############################################################################
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
{ package Mail::SendEasy::AUTH ;
|
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
11
|
use strict qw(vars) ; no warnings ;
|
|
1
|
|
|
1
|
|
4
|
|
|
1
|
|
|
|
|
67
|
|
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
103
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my (%CLASS_HPLOO) ;
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub new {
|
30
|
0
|
|
|
0
|
0
|
|
my $class = shift ;
|
31
|
0
|
|
|
|
|
|
my $this = bless({} , $class) ;
|
32
|
1
|
|
|
1
|
|
8
|
no warnings ;
|
|
1
|
|
|
|
|
14
|
|
|
1
|
|
|
|
|
447
|
|
33
|
0
|
|
|
|
|
|
my $undef = \'' ;
|
34
|
0
|
|
|
0
|
0
|
|
sub UNDEF {$undef} ;
|
35
|
0
|
0
|
|
|
|
|
if ( $CLASS_HPLOO{ATTR} ) {
|
36
|
0
|
|
|
|
|
|
foreach my $Key ( keys %{$CLASS_HPLOO{ATTR}} ) {
|
|
0
|
|
|
|
|
|
|
37
|
0
|
0
|
|
|
|
|
tie( $this->{$Key} => 'Class::HPLOO::TIESCALAR' , $CLASS_HPLOO{ATTR}{$Key}{tp} , $CLASS_HPLOO{ATTR}{$Key}{pr} , \$this->{CLASS_HPLOO_ATTR}{$Key} ) if !exists $this->{$Key} ;
|
38
|
0
|
0
|
|
|
|
|
} } my $ret_this = defined &AUTH ? $this->AUTH(@_) : undef ;
|
39
|
0
|
0
|
0
|
|
|
|
if ( ref($ret_this) && UNIVERSAL::isa($ret_this,$class) ) {
|
|
|
0
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
$this = $ret_this ;
|
41
|
0
|
0
|
0
|
|
|
|
if ( $CLASS_HPLOO{ATTR} && UNIVERSAL::isa($this,'HASH') ) {
|
42
|
0
|
|
|
|
|
|
foreach my $Key ( keys %{$CLASS_HPLOO{ATTR}} ) {
|
|
0
|
|
|
|
|
|
|
43
|
0
|
0
|
|
|
|
|
tie( $this->{$Key} => 'Class::HPLOO::TIESCALAR' , $CLASS_HPLOO{ATTR}{$Key}{tp} , $CLASS_HPLOO{ATTR}{$Key}{pr} , \$this->{CLASS_HPLOO_ATTR}{$Key} ) if !exists $this->{$Key} ;
|
44
|
|
|
|
|
|
|
} } } elsif ( $ret_this == $undef ) {
|
45
|
0
|
|
|
|
|
|
$this = undef ;
|
46
|
0
|
|
|
|
|
|
} return $this ;
|
47
|
|
|
|
|
|
|
}
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
1
|
|
16
|
use vars qw($VERSION) ;
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
1650
|
|
51
|
|
|
|
|
|
|
$VERSION = '0.01' ;
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
my %AUTH_TYPES = (
|
54
|
|
|
|
|
|
|
PLAIN => 1 ,
|
55
|
|
|
|
|
|
|
LOGIN => 1 ,
|
56
|
|
|
|
|
|
|
CRAM_MD5 => 0 ,
|
57
|
|
|
|
|
|
|
) ;
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
{
|
60
|
1
|
|
|
1
|
|
682
|
eval(q`use Digest::HMAC_MD5 qw(hmac_md5_hex)`) ;
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
$AUTH_TYPES{CRAM_MD5} = 1 if defined &hmac_md5_hex ;
|
62
|
|
|
|
|
|
|
}
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub AUTH {
|
65
|
0
|
0
|
0
|
0
|
0
|
|
my $this = ref($_[0]) && UNIVERSAL::isa($_[0],'UNIVERSAL') ? shift : undef ;
|
66
|
0
|
|
|
|
|
|
my $user = shift(@_) ;
|
67
|
0
|
|
|
|
|
|
my $pass = shift(@_) ;
|
68
|
0
|
|
|
|
|
|
my @authtypes = @_ ;
|
69
|
0
|
|
|
|
|
|
@_ = () ;
|
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
my $auth_sub ;
|
72
|
0
|
|
|
|
|
|
foreach my $auth ( @authtypes ) {
|
73
|
0
|
|
|
|
|
|
my $name = uc($auth) ;
|
74
|
0
|
0
|
|
|
|
|
if ( $AUTH_TYPES{$name} ) { $auth_sub = $name ; last ;}
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
}
|
76
|
|
|
|
|
|
|
|
77
|
0
|
0
|
0
|
|
|
|
$auth_sub = 'PLAIN' if !@authtypes && !$auth_sub ;
|
78
|
|
|
|
|
|
|
|
79
|
0
|
0
|
0
|
|
|
|
return UNDEF if !$auth_sub || $user eq '' || $pass eq '' ;
|
|
|
|
0
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
$this->{USER} = $user ;
|
82
|
0
|
|
|
|
|
|
$this->{PASS} = $pass ;
|
83
|
0
|
|
|
|
|
|
$this->{AUTHSUB} = $auth_sub ;
|
84
|
|
|
|
|
|
|
}
|
85
|
|
|
|
|
|
|
|
86
|
0
|
0
|
0
|
0
|
0
|
|
sub type { my $this = ref($_[0]) && UNIVERSAL::isa($_[0],'UNIVERSAL') ? shift : undef ; $this->{AUTHSUB} }
|
|
0
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub start {
|
89
|
0
|
0
|
0
|
0
|
0
|
|
my $this = ref($_[0]) && UNIVERSAL::isa($_[0],'UNIVERSAL') ? shift : undef ;
|
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
my $start = $this->{AUTHSUB} . "_start" ;
|
92
|
0
|
0
|
|
|
|
|
return &$start($this , @_) if defined &$start ;
|
93
|
0
|
|
|
|
|
|
return ;
|
94
|
|
|
|
|
|
|
}
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub step {
|
97
|
0
|
0
|
0
|
0
|
0
|
|
my $this = ref($_[0]) && UNIVERSAL::isa($_[0],'UNIVERSAL') ? shift : undef ;
|
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
my $step = $this->{AUTHSUB} . "_step" ;
|
100
|
0
|
0
|
|
|
|
|
return &$step($this , @_) if defined &$step ;
|
101
|
0
|
|
|
|
|
|
return ;
|
102
|
|
|
|
|
|
|
}
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
#############
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub PLAIN_start {
|
107
|
0
|
0
|
0
|
0
|
0
|
|
my $this = ref($_[0]) && UNIVERSAL::isa($_[0],'UNIVERSAL') ? shift : undef ;
|
108
|
|
|
|
|
|
|
|
109
|
0
|
0
|
|
|
|
|
my @parts = map { defined $this->{$_} ? $this->{$_} : ''} qw(USER USER PASS);
|
|
0
|
|
|
|
|
|
|
110
|
0
|
|
|
|
|
|
return join("\0", @parts) ;
|
111
|
|
|
|
|
|
|
}
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
#############
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub LOGIN_step {
|
116
|
0
|
0
|
0
|
0
|
0
|
|
my $this = ref($_[0]) && UNIVERSAL::isa($_[0],'UNIVERSAL') ? shift : undef ;
|
117
|
0
|
|
|
|
|
|
my $string = shift(@_) ;
|
118
|
|
|
|
|
|
|
|
119
|
0
|
0
|
|
|
|
|
$string =~ /password/i ? $this->{PASS} :
|
|
|
0
|
|
|
|
|
|
120
|
|
|
|
|
|
|
$string =~ /username/i ? $this->{USER} :
|
121
|
|
|
|
|
|
|
'' ;
|
122
|
|
|
|
|
|
|
}
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
#############
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub CRAM_MD5_step {
|
127
|
0
|
0
|
0
|
0
|
0
|
|
my $this = ref($_[0]) && UNIVERSAL::isa($_[0],'UNIVERSAL') ? shift : undef ;
|
128
|
0
|
|
|
|
|
|
my $string = shift(@_) ;
|
129
|
|
|
|
|
|
|
|
130
|
0
|
0
|
|
|
|
|
my ($user, $pass) = map { defined $this->{$_} ? $this->{$_} : '' } qw(USER PASS) ;
|
|
0
|
|
|
|
|
|
|
131
|
0
|
|
|
|
|
|
$user . " " . hmac_md5_hex($string,$pass);
|
132
|
0
|
|
|
|
|
|
return $user ;
|
133
|
|
|
|
|
|
|
}
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
}
|
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
1;
|
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
__END__
|