Invalid Credentials error not reported correctly #2

Closed
matthauck opened this Issue Mar 20, 2012 · 0 comments

1 participant

@matthauck

I currently have an LDAP server I'm trying to access via jruby-ldap. The code is as follows:

conn = LDAP::Conn.new 'ldap.company.com', 1389
begin
conn.bind(dn, pass)
puts "Authenticated!"
rescue LDAP::ResultError => e
puts "Sound the alarm! '#{e.message}'}"
end

The funny thing is that when my credentials are wrong, it reports error code -1: "Can't contact LDAP Server", even though the proper error code should be 49: Invalid Credentials. When I run the same code with MRI ruby (or with ldapsearch), it properly reports the right error messages.

It would be helpful to distinguish whether an bind failure is coming from not being able to contact the LDAP server, versus a user's password being wrong and thus a failed authentication.

@matthauck matthauck closed this Mar 20, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment