Skip Menu |

This queue is for tickets about the Catalyst-Authentication-Store-LDAP CPAN distribution.

Report information
The Basics
Id: 39113
Status: resolved
Priority: 0/
Queue: Catalyst-Authentication-Store-LDAP

People
Owner: karman [...] cpan.org
Requestors: chisel [...] chizography.net
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.1002
Fixed in: (no value)



Subject: auth should not be case-sensitive
As I understand it, LDAP authentication is/should be case insensitive. Backend.pm does an "eq" test on the value looked up and the value returned. This fails if you authenticate with "sAMAccountName=UserName" but the server returns "username" in the user data. I've attached a failing test (for 0.1002) and a patch to make the sanity check in Backend.pm a case-insensitive match.
Subject: 50.auth.case.sensitivity.t
#!/usr/bin/env perl # vim: ts=8 sts=4 et sw=4 sr sta use strict; use warnings; use Catalyst::Exception; use Test::More tests => 4; use lib 't/lib'; use LDAPTest; my $server = LDAPTest::spawn_server(); use_ok("Catalyst::Authentication::Store::LDAP::Backend"); my $back = Catalyst::Authentication::Store::LDAP::Backend->new( { 'ldap_server' => LDAPTest::server_host(), # can test the timeout SKIP with this 'ldap_server_options' => { timeout => -1, debug => $ENV{PERL_DEBUG} || 0 }, 'binddn' => 'anonymous', 'bindpw' => 'dontcarehow', 'start_tls' => 0, 'user_basedn' => 'ou=foobar', 'user_filter' => '(&(objectClass=person)(uid=%s))', 'user_scope' => 'one', 'user_field' => 'uid', 'use_roles' => 0, } ); isa_ok( $back, "Catalyst::Authentication::Store::LDAP::Backend" ); ok( my $user_mixed = $back->find_user( { username => 'SOmeBOdy' } ), "find_user (mixed case)" ); isa_ok( $user_mixed, "Catalyst::Authentication::Store::LDAP::User" );
Subject: ldap_auth_case.patch
--- lib/Catalyst/Authentication/Store/LDAP/Backend.pm.original 2008-09-09 09:51:18.000000000 +0100 +++ lib/Catalyst/Authentication/Store/LDAP/Backend.pm 2008-09-09 09:53:51.000000000 +0100 @@ -315,7 +315,8 @@ # a little extra sanity check with the 'eq' since LDAP already # says it matches. if ( defined($entry) ) { - unless ( $entry->get_value($user_field) eq $id ) { + unless ( $entry->get_value($user_field) =~ m{\A$id\z}ixms ) { + warn $entry->get_value($user_field); Catalyst::Exception->throw( "LDAP claims '$user_field' equals '$id' but results entry does not match." );
On Tue Sep 09 05:04:50 2008, CHISEL wrote: Show quoted text
> I've attached a failing test (for 0.1002) and a patch to make the sanity > check in Backend.pm a case-insensitive match.
and now the patch without the warning I added - sorry
--- lib/Catalyst/Authentication/Store/LDAP/Backend.pm.original 2008-09-09 09:51:18.000000000 +0100 +++ lib/Catalyst/Authentication/Store/LDAP/Backend.pm 2008-09-09 10:06:21.000000000 +0100 @@ -315,7 +315,7 @@ # a little extra sanity check with the 'eq' since LDAP already # says it matches. if ( defined($entry) ) { - unless ( $entry->get_value($user_field) eq $id ) { + unless ( $entry->get_value($user_field) =~ m{\A$id\z}ixms ) { Catalyst::Exception->throw( "LDAP claims '$user_field' equals '$id' but results entry does not match." );
Subject: Re: [rt.cpan.org #39113] auth should not be case-sensitive
Date: Tue, 09 Sep 2008 16:07:37 -0500
To: bug-Catalyst-Authentication-Store-LDAP [...] rt.cpan.org
From: Peter Karman <peter [...] peknet.com>
This bug should be fixed in trunk: http://dev.catalystframework.org/repos/Catalyst/Catalyst-Authentication-Store-LDAP/trunk please try that version and report if it fixes the issue. If it does, I'll push a new release to CPAN. On 09/09/2008 04:07 AM, Chisel Wright via RT wrote: Show quoted text
> Queue: Catalyst-Authentication-Store-LDAP > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=39113 > > > On Tue Sep 09 05:04:50 2008, CHISEL wrote:
>> I've attached a failing test (for 0.1002) and a patch to make the sanity >> check in Backend.pm a case-insensitive match.
> > > and now the patch without the warning I added - sorry
-- Peter Karman . peter@peknet.com . http://peknet.com/
On Tue Sep 09 17:26:21 2008, peter@peknet.com wrote: Show quoted text
> This bug should be fixed in trunk
Works just as I'd hoped. Many thanks.
0.1003 just uploaded to CPAN.