bearded / ruby-ldap

Ruby/LDAP is an extension library for Ruby. It provides the interface to some LDAP libraries (e.g. OpenLDAP, Netscape SDK and Active Directory). The common API for application development is described in RFC1823 and is supported by Ruby/LDAP.
http://rubyforge.org/projects/ruby-ldap/
Other
66 stars 34 forks source link

expose ldap error reason somehow #40

Open celesteking opened 8 years ago

celesteking commented 8 years ago

Hi there. This is a complex topic, but right now what's needed is more info from underlying layer.

Take for ex.,

> begin; LDAP::SSLConn.new(host, port, true) ; rescue => e ; e ; end
=> #<LDAP::ResultError: Connect error>

No way of knowing what caused it. You can't access errno because you've got no LDAP::Conn object returned. Chicken and egg situation, basically.

In this particular case it was SSL verification that failed (hostname vs cert CN mismatch). There could be SASL failure later on, which I guess isn't logged properly either.

Thanks.