I’m trying to search using an encrypted password filter, but it doesn’t match any thing!!
is there a way to get match with it!!!
here is my code:
ldap = Net::LDAP.new :host => "----",
:port => 389,
:auth => {
:method => :simple,
:username => "----",
:password => "----"
}
filter = Net::LDAP::Filter.eq("userPassword", "1212")
filter2 = Net::LDAP::Filter.eq("cn", "general*")
tree_base = "dc=----,dc=---"
ldap.search(:base => tree_base, :filter => filter & filter2) do |entry|
puts "mail: #{entry.mail}"
puts "pw: #{entry.userPassword}"
end
it doesn’t return any results but when I replace the filter of pw with another it works!!!
This is not a correct technique in LDAP. You should first search for the user, by username only, and then attempt to bind to LDAP using that username and password. If it succeeds, the password is correct.