| 1 | package Authen::Simple::SMB; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use base 'Authen::Simple::Adapter'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | ▶ | use Authen::Smb; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use Params::Validate qw[]; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 1 | our $VERSION = 0.1; | |||||||||
| 11 | |||||||||||
| 12 | 1 | __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 | 0 | ▶ | sub check { | ||||||||
|
Subroutine
check: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||
| 28 | 0 | 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 | ▶ | if ( $status == 0 ) { # NTV_NO_ERROR | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | |||||||||||
| 35 | 0 | ▶ | $self->log->debug( qq/Successfully authenticated user '$username' using domain '$domain'./ ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | if $self->log; | ||||||||||
| 37 | |||||||||||
| 38 | 0 | return 1; | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 0 | ▶ | if ( $status == 1 ) { # NTV_SERVER_ERROR | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | 0 | ▶ | $self->log->error( qq/Failed to authenticate user '$username' using domain '$domain'. Reason: 'Received a Server Error'/ ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | if $self->log; | ||||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | 0 | ▶ | if ( $status == 2 ) { # NTV_PROTOCOL_ERROR | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | 0 | ▶ | $self->log->error( qq/Failed to authenticate user '$username' using domain '$domain'. Reason: 'Received a Protocol Error'/ ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 48 | if $self->log; | ||||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | 0 | ▶ | if ( $status == 3 ) { # NTV_LOGON_ERROR | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | 0 | ▶ | $self->log->debug( qq/Failed to authenticate user '$username' using domain '$domain'. Reason: 'Invalid credentials'/ ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 53 | if $self->log; | ||||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | 0 | return 0; | |||||||||
| 57 | } | ||||||||||
| 58 | |||||||||||
| 59 | 1 | 1; | |||||||||
| 60 | |||||||||||
| 61 | __END__ | ||||||||||