line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Authen::Simple::SMB; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
794
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
36
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
32
|
|
5
|
1
|
|
|
1
|
|
14
|
use base 'Authen::Simple::Adapter'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1007
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
43652
|
use Authen::Smb; |
|
1
|
|
|
|
|
3414
|
|
|
1
|
|
|
|
|
49
|
|
8
|
1
|
|
|
1
|
|
9
|
use Params::Validate qw[]; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
225
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = 0.1; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
__PACKAGE__->options({ |
13
|
|
|
|
|
|
|
domain => { |
14
|
|
|
|
|
|
|
type => Params::Validate::SCALAR, |
15
|
|
|
|
|
|
|
optional => 0 |
16
|
|
|
|
|
|
|
}, |
17
|
|
|
|
|
|
|
pdc => { |
18
|
|
|
|
|
|
|
type => Params::Validate::SCALAR, |
19
|
|
|
|
|
|
|
optional => 0 |
20
|
|
|
|
|
|
|
}, |
21
|
|
|
|
|
|
|
bdc => { |
22
|
|
|
|
|
|
|
type => Params::Validate::SCALAR, |
23
|
|
|
|
|
|
|
optional => 1 |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
}); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub check { |
28
|
0
|
|
|
0
|
1
|
|
my ( $self, $username, $password ) = @_; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
my $domain = $self->domain; |
31
|
0
|
|
|
|
|
|
my $status = Authen::Smb::authen( $username, $password, $self->pdc, $self->bdc, $domain ); |
32
|
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
|
if ( $status == 0 ) { # NTV_NO_ERROR |
34
|
|
|
|
|
|
|
|
35
|
0
|
0
|
|
|
|
|
$self->log->debug( qq/Successfully authenticated user '$username' using domain '$domain'./ ) |
36
|
|
|
|
|
|
|
if $self->log; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
return 1; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
0
|
0
|
|
|
|
|
if ( $status == 1 ) { # NTV_SERVER_ERROR |
42
|
0
|
0
|
|
|
|
|
$self->log->error( qq/Failed to authenticate user '$username' using domain '$domain'. Reason: 'Received a Server Error'/ ) |
43
|
|
|
|
|
|
|
if $self->log; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
0
|
0
|
|
|
|
|
if ( $status == 2 ) { # NTV_PROTOCOL_ERROR |
47
|
0
|
0
|
|
|
|
|
$self->log->error( qq/Failed to authenticate user '$username' using domain '$domain'. Reason: 'Received a Protocol Error'/ ) |
48
|
|
|
|
|
|
|
if $self->log; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
0
|
0
|
|
|
|
|
if ( $status == 3 ) { # NTV_LOGON_ERROR |
52
|
0
|
0
|
|
|
|
|
$self->log->debug( qq/Failed to authenticate user '$username' using domain '$domain'. Reason: 'Invalid credentials'/ ) |
53
|
|
|
|
|
|
|
if $self->log; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
return 0; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |