Ruby LDAP Search with correct AD credentials, message="No Such Object"

145 views
Skip to first unread message

David Pardy

unread,
Nov 20, 2015, 12:49:32 PM11/20/15
to Ruby LDAP
Hi, I've been getting fairly frustrated with this in trying to return some data using ruby ldap. Ruby version is: ruby 2.2.1p85 

The credentials are fine: I can connect without issues.

This will eventually be going into a Rails 4 application but just doing a simple .rb file for now. 

When I run 'ruby ldap.rb' I get

#<OpenStruct code=32, error_message="0000208D: NameErr: DSID-03100238, problem 2001 (NO_OBJECT), data 0, best match of:\n\t'DC=enterprise,DC=my-company,DC=com'\n\u0000", matched_dn="DC=enterprise,DC=my-company,DC=com", message="No Such Object">


My IT admin set me a screenshot of what our AD attributes are. One of them, to no surprise, is 'sAMAAccountName', so I'm just trying to do a simple search on that. 


require 'net/ldap'

 

ldap = Net::LDAP.new :host => "123.456.789.12",

    :port => 389,

    :auth => { 

          :method => :simple,

          :username => "me...@my-company.com",

          :password => "Password"

    }


filter = Net::LDAP::Filter.eq("sAMAccountName", "*")

treebase = "dc=Users - Employees,dc=enterprise,dc=my-company,dc=com"


res=ldap.search(:base => treebase, :filter => filter)


p ldap.get_operation_result

puts "below" 


What is the issue here? I am at a loss and would sincerely appreciate any feedback. 


Thanks,


David



Jerry Cheung

unread,
Nov 21, 2015, 2:05:48 PM11/21/15
to Ruby LDAP
Hi David,

Unfortunately, I don't have an AD license and install to test with. It may help to specify the Net::LDAP library version (puts Net::LDAP::VERSION) in case anyone has run into the problem.

Matt Davies

unread,
Nov 21, 2015, 2:41:54 PM11/21/15
to ruby...@googlegroups.com
("sAMAccountName"

'sAMAAccountName',

It's described differently in your post.

Capitalisation is the cause of 43% of computer problEms

PermissIONs second






--
You received this message because you are subscribed to the Google Groups "Ruby LDAP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-ldap+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Pardy

unread,
Nov 23, 2015, 8:46:37 AM11/23/15
to Ruby LDAP
Hi Jerry, the version is 0.12.0. And @Matt Davies, that was a typo on my part: it is indeed sAMAccountName in the ruby code. 
Reply all
Reply to author
Forward
0 new messages