Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: Benjamin Tzschoppe
Ruby 1.9.2 and Net::LDAP#search [ reply ]  
2010-07-19 09:45
hi community,

we have a problem with Net::LDAP#search. Our code is:

auth = {:method => :simple, :username => ldap_dn, :password => password}
Net::LDAP.open( :host => Admin::Application::LDAP_CONFIGURATION[:host], :port => Admin::Application::LDAP_CONFIGURATION[:port], :auth => auth ) do |ldap|
treebase = "OU=Brilliant,dc=brillinat,dc=de"
# attrs = ['objectclass', 'sAMAccountName']
filter = Net::LDAP::Filter.eq( "sAMAccountName", "btzschoppe" )
ldap.search( :base => treebase, :filter=>filter, :return_result=>true ) do |entry|
puts "DN: #{entry.dn}"
end
puts ldap.get_operation_result


end

It seems to be correct, but we always get <OpenStruct code=10 message="unkown result(10)"> as ldap.get_operation_result. I am not a LDAP pro but google says the status code 10 from LDAP is referral.

By the way our LDAP server is AD and binding and authentifikation is no problem.

Thanks a lot for your help!
Benny