Authen-Simple-SMB-0.1/ 0040755 0000765 0000765 00000000000 10356613716 014312 5 ustar chansen chansen Authen-Simple-SMB-0.1/Build.PL 0100644 0000765 0000765 00000000532 10356613716 015603 0 ustar chansen chansen use strict;
use Module::Build;
my $build = Module::Build->new(
license => 'perl',
module_name => 'Authen::Simple::SMB',
requires => {
'Authen::Simple' => 0,
'Authen::Smb' => 0,
},
create_makefile_pl => 'traditional',
create_readme => 1
);
$build->create_build_script;
Authen-Simple-SMB-0.1/Changes 0100644 0000765 0000765 00000000143 10356613716 015600 0 ustar chansen chansen Revision history for Perl extension Authen::Simple::SMB
0.01 2006-01-03 00:00
- first release
Authen-Simple-SMB-0.1/lib/ 0040755 0000765 0000765 00000000000 10356613716 015060 5 ustar chansen chansen Authen-Simple-SMB-0.1/lib/Authen/ 0040755 0000765 0000765 00000000000 10356613716 016304 5 ustar chansen chansen Authen-Simple-SMB-0.1/lib/Authen/Simple/ 0040755 0000765 0000765 00000000000 10356613716 017535 5 ustar chansen chansen Authen-Simple-SMB-0.1/lib/Authen/Simple/SMB.pm 0100644 0000765 0000765 00000006020 10356613716 020507 0 ustar chansen chansen package Authen::Simple::SMB;
use strict;
use warnings;
use base 'Authen::Simple::Adapter';
use Authen::Smb;
use Params::Validate qw[];
our $VERSION = 0.1;
__PACKAGE__->options({
domain => {
type => Params::Validate::SCALAR,
optional => 0
},
pdc => {
type => Params::Validate::SCALAR,
optional => 0
},
bdc => {
type => Params::Validate::SCALAR,
optional => 1
}
});
sub check {
my ( $self, $username, $password ) = @_;
my $domain = $self->domain;
my $status = Authen::Smb::authen( $username, $password, $self->pdc, $self->bdc, $domain );
if ( $status == 0 ) { # NTV_NO_ERROR
$self->log->debug( qq/Successfully authenticated user '$username' using domain '$domain'./ )
if $self->log;
return 1;
}
if ( $status == 1 ) { # NTV_SERVER_ERROR
$self->log->error( qq/Failed to authenticate user '$username' using domain '$domain'. Reason: 'Received a Server Error'/ )
if $self->log;
}
if ( $status == 2 ) { # NTV_PROTOCOL_ERROR
$self->log->error( qq/Failed to authenticate user '$username' using domain '$domain'. Reason: 'Received a Protocol Error'/ )
if $self->log;
}
if ( $status == 3 ) { # NTV_LOGON_ERROR
$self->log->debug( qq/Failed to authenticate user '$username' using domain '$domain'. Reason: 'Invalid credentials'/ )
if $self->log;
}
return 0;
}
1;
__END__
=head1 NAME
Authen::Simple::SMB - Simple SMB authentication
=head1 SYNOPSIS
use Authen::Simple::SMB;
my $smb = Authen::Simple::SMB->new(
domain => 'DOMAIN',
pdc => 'PDC'
);
if ( $smb->authenticate( $username, $password ) ) {
# successfull authentication
}
# or as a mod_perl Authen handler
PerlModule Authen::Simple::Apache
PerlModule Authen::Simple::SMB
PerlSetVar AuthenSimpleSMB_domain "DOMAIN"
PerlSetVar AuthenSimpleSMB_pdc "PDC"
PerlAuthenHandler Authen::Simple::SMB
AuthType Basic
AuthName "Protected Area"
Require valid-user
=head1 DESCRIPTION
Authenticate against an SMB server.
=head1 METHODS
=over 4
=item * new
This method takes a hash of parameters. The following options are
valid:
=over 8
=item * domain
Domain to authenticate against. Required.
domain => 'NTDOMAIN'
=item * pdc
Primary Domain Controller. Required.
pdc => 'PDC'
=item * bdc
Backup Domain Controller.
bdc => 'BDC'
=item * log
Any object that supports C, C, C and C.
log => Log::Log4perl->get_logger('Authen::Simple::SMB')
=back
=item * authenticate( $username, $password )
Returns true on success and false on failure.
=back
=head1 SEE ALSO
L.
L.
=head1 AUTHOR
Christian Hansen C
=head1 COPYRIGHT
This program is free software, you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
Authen-Simple-SMB-0.1/Makefile.PL 0100644 0000765 0000765 00000000674 10356613716 016270 0 ustar chansen chansen # Note: this file was auto-generated by Module::Build::Compat version 0.03
use ExtUtils::MakeMaker;
WriteMakefile
(
'NAME' => 'Authen::Simple::SMB',
'VERSION_FROM' => 'lib/Authen/Simple/SMB.pm',
'PREREQ_PM' => {
'Authen::Simple' => '0',
'Authen::Smb' => '0'
},
'INSTALLDIRS' => 'site',
'PL_FILES' => {}
)
;
Authen-Simple-SMB-0.1/MANIFEST 0100644 0000765 0000765 00000000212 10356613716 015433 0 ustar chansen chansen Build.PL
Changes
lib/Authen/Simple/SMB.pm
MANIFEST This list of files
t/01use.t
t/02pod.t
t/03podcoverage.t
META.yml
Makefile.PL
README
Authen-Simple-SMB-0.1/META.yml 0100644 0000765 0000765 00000000471 10356613716 015562 0 ustar chansen chansen ---
name: Authen-Simple-SMB
version: 0.1
author:
- Christian Hansen C
abstract: Simple SMB authentication
license: perl
requires:
Authen::Simple: 0
Authen::Smb: 0
provides:
Authen::Simple::SMB:
file: lib/Authen/Simple/SMB.pm
version: 0.1
generated_by: Module::Build version 0.2611
Authen-Simple-SMB-0.1/README 0100644 0000765 0000765 00000003275 10356613716 015176 0 ustar chansen chansen NAME
Authen::Simple::SMB - Simple SMB authentication
SYNOPSIS
use Authen::Simple::SMB;
my $smb = Authen::Simple::SMB->new(
domain => 'DOMAIN',
pdc => 'PDC'
);
if ( $smb->authenticate( $username, $password ) ) {
# successfull authentication
}
# or as a mod_perl Authen handler
PerlModule Authen::Simple::Apache
PerlModule Authen::Simple::SMB
PerlSetVar AuthenSimpleSMB_domain "DOMAIN"
PerlSetVar AuthenSimpleSMB_pdc "PDC"
PerlAuthenHandler Authen::Simple::SMB
AuthType Basic
AuthName "Protected Area"
Require valid-user
DESCRIPTION
Authenticate against an SMB server.
METHODS
* new
This method takes a hash of parameters. The following options are
valid:
* domain
Domain to authenticate against. Required.
domain => 'NTDOMAIN'
* pdc Primary Domain Controller. Required.
pdc => 'PDC'
* bdc Backup Domain Controller.
bdc => 'BDC'
* log Any object that supports "debug", "info", "error" and
"warn".
log => Log::Log4perl->get_logger('Authen::Simple::SMB')
* authenticate( $username, $password )
Returns true on success and false on failure.
SEE ALSO
Authen::Simple.
Authen::Smb.
AUTHOR
Christian Hansen "ch@ngmedia.com"
COPYRIGHT
This program is free software, you can redistribute it and/or modify it
under the same terms as Perl itself.
Authen-Simple-SMB-0.1/t/ 0040755 0000765 0000765 00000000000 10356613716 014555 5 ustar chansen chansen Authen-Simple-SMB-0.1/t/01use.t 0100644 0000765 0000765 00000000073 10356613716 015674 0 ustar chansen chansen use Test::More tests => 1;
use_ok('Authen::Simple::SMB');
Authen-Simple-SMB-0.1/t/02pod.t 0100644 0000765 0000765 00000000276 10356613716 015670 0 ustar chansen chansen use Test::More;
eval "use Test::Pod 1.14";
plan skip_all => 'Test::Pod 1.14 required' if $@;
plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
all_pod_files_ok();
Authen-Simple-SMB-0.1/t/03podcoverage.t 0100644 0000765 0000765 00000000365 10356613716 017404 0 ustar chansen chansen use Test::More;
eval "use Test::Pod::Coverage 1.04";
plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@;
plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
all_pod_coverage_ok( { trustme => [ qr/^check$/ ] } );