line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Protocol::Database::PostgreSQL::Backend::AuthenticationRequest; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
11
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
48
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.005'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use parent qw(Protocol::Database::PostgreSQL::Backend); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Protocol::Database::PostgreSQL::Backend::AuthenticationRequest - an authentication request message |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 DESCRIPTION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
50
|
use Log::Any qw($log); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
0
|
0
|
0
|
sub type { 'authentication_request' } |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
0
|
0
|
0
|
sub auth_type { shift->{auth_type} } |
23
|
0
|
|
|
0
|
0
|
0
|
sub password_type { shift->{password_type} } |
24
|
0
|
|
|
0
|
0
|
0
|
sub password_salt { shift->{password_salt} } |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub new_from_message { |
27
|
1
|
|
|
1
|
1
|
6
|
my ($class, $msg) = @_; |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
7
|
my (undef, undef, $auth_code, $data) = unpack('C1N1N1a*', $msg); |
30
|
1
|
50
|
|
|
|
8
|
my $auth_type = $Protocol::Database::PostgreSQL::AUTH_TYPE{$auth_code} or die "Invalid auth code $auth_code received"; |
31
|
1
|
|
|
|
|
6
|
$log->tracef("Auth message [%s]", $auth_type); |
32
|
1
|
|
|
|
|
6
|
my %info = ( |
33
|
|
|
|
|
|
|
auth_type => $auth_type, |
34
|
|
|
|
|
|
|
); |
35
|
1
|
50
|
|
|
|
7
|
if($auth_type eq 'AuthenticationMD5Password') { |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
36
|
0
|
|
|
|
|
0
|
my ($salt) = unpack('a4', $data); |
37
|
0
|
|
|
|
|
0
|
$info{password_type} = 'md5'; |
38
|
0
|
|
|
|
|
0
|
$info{password_salt} = $salt; |
39
|
|
|
|
|
|
|
} elsif($auth_type eq 'AuthenticationCleartextPassword') { |
40
|
1
|
|
|
|
|
4
|
$info{password_type} = 'plain'; |
41
|
|
|
|
|
|
|
} elsif($auth_type eq 'AuthenticationOk') { |
42
|
|
|
|
|
|
|
# No action required |
43
|
|
|
|
|
|
|
} else { |
44
|
0
|
|
|
|
|
0
|
die 'unknown auth thing here'; |
45
|
|
|
|
|
|
|
} |
46
|
1
|
|
|
|
|
13
|
return $class->new( |
47
|
|
|
|
|
|
|
%info, |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 AUTHOR |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Tom Molesworth |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 LICENSE |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Copyright Tom Molesworth 2010-2019. Licensed under the same terms as Perl itself. |
60
|
|
|
|
|
|
|
|