Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make LDAP bind failure cause an ldap_error, rather than an invalid_credentials #52

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mtalcott
Copy link

@mtalcott mtalcott commented Nov 6, 2014

Fixes #51

@@ -71,7 +71,9 @@ def bind_as(args = {})
result = false
@connection.open do |me|
rs = me.search args
if rs and rs.first and dn = rs.first.dn
raise ConnectionError.new("bind failed") unless rs
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Net::LDAP#search returns nil if the operation was not successful: https://github.com/ruby-ldap/ruby-net-ldap/blob/master/lib/net/ldap.rb#L722-765

Previously, this was just not entering the if and returning the default result of false. If search can successfully connect, but cannot find results (bad username/password in the params), #search returns an empty array, and we still get invalid_credentials as a result.

@aldanor
Copy link

aldanor commented Feb 20, 2015

+1

1 similar comment
@c-jones
Copy link

c-jones commented Feb 1, 2016

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Differentiate between invalid binding credentials and invalid login credentials
3 participants