LDAP search and return

Hi all

I am trying to connect to our LDAP server(Active Directory :frowning: )

I can do a successful bind, the problem I have is getting the data :frowning:

I think the conn.search is correct

result = conn.search( ‘ou=accounts, dc=example, dc=com’,
LDAP::LDAP_SCOPE_SUBTREE, ‘samaccountname=myuser’)

it doesn’t error for the above, how do I extract the information from
the search?

Many thanks all

Stuart

Which library are you using? Net::LDAP or one of the native ones?

Francis C. wrote:

Which library are you using? Net::LDAP or one of the native ones?

I’m using ruby ldap, as in http://ruby-ldap.sourceforge.net/

LDAP::Conn.new

Not to worry, I found a script that does what I want it to do anyway :slight_smile:

conn.search( ‘ou=users,ou=nyc,dc=corp,dc=google,dc=com’,
LDAP::LDAP_SCOPE_SUBTREE, ‘cn=*’, [‘cn’]) do |x|
count += 1
end

Thanks anyway

Stuart

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs