From: Peter Karman Date: Wed, 9 Jan 2013 14:51:44 +0000 (+0000) Subject: if username is passed to bind, assume password is passed too and do not default to... X-Git-Tag: v1.013~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=50f88c5d27ff7f70dc564592de7bd93aa08fb282;p=catagits%2FCatalyst-Authentication-Store-LDAP.git if username is passed to bind, assume password is passed too and do not default to configured password. https://rt.cpan.org/Ticket/Display.html?id=81908 --- diff --git a/lib/Catalyst/Authentication/Store/LDAP/Backend.pm b/lib/Catalyst/Authentication/Store/LDAP/Backend.pm index bd5fbdf..43819f9 100644 --- a/lib/Catalyst/Authentication/Store/LDAP/Backend.pm +++ b/lib/Catalyst/Authentication/Store/LDAP/Backend.pm @@ -214,8 +214,14 @@ sub ldap_bind { if ( !defined($ldap) ) { Catalyst::Exception->throw("LDAP Server undefined!"); } - $binddn ||= $self->binddn; - $bindpw ||= $self->bindpw; + + # if username is present, make sure password is present too. + # see https://rt.cpan.org/Ticket/Display.html?id=81908 + if ( !defined $binddn ) { + $binddn = $self->binddn; + $bindpw = $self->bindpw; + } + if ( $binddn eq "anonymous" ) { $self->_ldap_bind_anon($ldap); }