I m using following code to check whether the provided parameters are correct or not for binding..
require 'rubygems'
require 'net/ldap'
ldap = Net::LDAP.new
ldap.host = your_server_ip_address
ldap.port = 389
ldap.auth "joe_user", "opensesame"
if ldap.bind
# authentication succeeded
else
# authentication failed
end
If user and password is incorrect it returns false but if host or port number is incorrect it displays error (exception)
no connection to server (Net::LDAP::LdapError)
I want to capture this error also and want to show error msg separately for incoreect user/pass and for incorrect port/host name. How can i do this