Authen-Simple-SMB-0.1/0040755000076500007650000000000010356613716014312 5ustar chansenchansenAuthen-Simple-SMB-0.1/Build.PL0100644000076500007650000000053210356613716015603 0ustar chansenchansenuse 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/Changes0100644000076500007650000000014310356613716015600 0ustar chansenchansenRevision history for Perl extension Authen::Simple::SMB 0.01 2006-01-03 00:00 - first release Authen-Simple-SMB-0.1/lib/0040755000076500007650000000000010356613716015060 5ustar chansenchansenAuthen-Simple-SMB-0.1/lib/Authen/0040755000076500007650000000000010356613716016304 5ustar chansenchansenAuthen-Simple-SMB-0.1/lib/Authen/Simple/0040755000076500007650000000000010356613716017535 5ustar chansenchansenAuthen-Simple-SMB-0.1/lib/Authen/Simple/SMB.pm0100644000076500007650000000602010356613716020507 0ustar chansenchansenpackage 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.PL0100644000076500007650000000067410356613716016270 0ustar chansenchansen# 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/MANIFEST0100644000076500007650000000021210356613716015433 0ustar chansenchansenBuild.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.yml0100644000076500007650000000047110356613716015562 0ustar chansenchansen--- 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/README0100644000076500007650000000327510356613716015176 0ustar chansenchansenNAME 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/0040755000076500007650000000000010356613716014555 5ustar chansenchansenAuthen-Simple-SMB-0.1/t/01use.t0100644000076500007650000000007310356613716015674 0ustar chansenchansenuse Test::More tests => 1; use_ok('Authen::Simple::SMB'); Authen-Simple-SMB-0.1/t/02pod.t0100644000076500007650000000027610356613716015670 0ustar chansenchansenuse 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.t0100644000076500007650000000036510356613716017404 0ustar chansenchansenuse 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$/ ] } );