Skip to content

Commit

Permalink
Backported LDAP empty password fix from master.
Browse files Browse the repository at this point in the history
  • Loading branch information
theory committed Nov 13, 2009
1 parent fcbf802 commit 69aa5d4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions lib/Bric/Changes.pod
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ Avoid C<//> in distribution file names and/or directories. This caused
problems with FTP distribution, but it seems prudent to fix it for SFTP and
WebDAV, too. [David]

=item *

Fix LDAP 500 Error when a password is blank. Thanks to Aaron Fuleki for the
report (Bug #103). [David]

=back

=head1 VERSION 1.10.7 (2009-03-12)
Expand Down
7 changes: 5 additions & 2 deletions lib/Bric/Util/AuthLDAP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use strict;
# Programmatic Dependencies
use Bric::Config qw(:ldap);
use Bric::Util::Fault qw(throw_auth);
use Net::LDAP qw(LDAP_INVALID_CREDENTIALS LDAP_SUCCESS);
use Net::LDAP qw(LDAP_INVALID_CREDENTIALS LDAP_SUCCESS LDAP_INAPPROPRIATE_AUTH);
use Net::LDAP::Util qw(ldap_error_desc);
use Net::LDAP::Filter;

Expand Down Expand Up @@ -84,8 +84,11 @@ sub authenticate {
version => LDAP_VERSION,
onerror => sub {
my $mesg = shift;
my $code = $mesg->code;
# Invalid credentials are okay.
return $mesg if $mesg->code == LDAP_INVALID_CREDENTIALS;
return $mesg if grep { $_ == $code }
LDAP_INVALID_CREDENTIALS,
LDAP_INAPPROPRIATE_AUTH;
throw_auth "LDAP Error: " . ldap_error_desc($mesg);
}
) or throw_auth error => "Unable to connect to LDAP Server", payload => $@;
Expand Down
1 change: 1 addition & 0 deletions t/Bric/Util/AuthEngines/Test.pm
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ BEGIN {
my $caller = caller or return;
no strict 'refs';
*{"${caller}::LDAP_INVALID_CREDENTIALS"} = sub () { 49 };
*{"${caller}::LDAP_INAPPROPRIATE_AUTH"} = sub () { 48 };
*{"${caller}::LDAP_SUCCESS"} = sub () { 0 };
}
my $ldap = bless {};
Expand Down

0 comments on commit 69aa5d4

Please sign in to comment.