Skip to content

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