Re: Net::LDAP 0.0.4 released

I do two things with ldap - validation (does the user exist?) and

don’t have any directories that permit one. So you could try
)

if rs

you’re in

else

you’re not

end

Does this work for you?

Works perfectly, thanks! I removed the parens from the filter, however.
My experience has showed me that not all platforms liked the parens and
it works fine without them (at least it does here at work).

Now, what would be the best way to test for the mere presence of a user
record, i.e. no password?

Regards,

Dan

This communication is the property of Qwest and may contain confidential
or
privileged information. Unauthorized use of this communication is
strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and
destroy
all copies of the communication and any attachments.

On 8/15/06, Berger, Daniel [email protected] wrote:

On 8/15/06, Berger, Daniel [email protected] wrote:

Works perfectly, thanks! I removed the parens from the filter, however.
My experience has showed me that not all platforms liked the parens and
it works fine without them (at least it does here at work).

Now, what would be the best way to test for the mere presence of a user
record, i.e. no password?

I noticed you had given your original code sample without parens around
the
filter. Out of curiosity, what kind of LDAP server are you connecting
to?
Searching for a user without binding ought to be easy:

require ‘net/ldap’

ldap = Net::LDAP.new
ldap.host = “ldap.foo.com
ldap.base = “ou=People,o=foo.com

rs = ldap.search( :filter => “uid=djberge”)

if rs
puts “DN: #{rs.first.dn}”
end

By the way, you don’t have to instantiate a Net::LDAP object every time
you
need to hit the server. Just instantiate it once and keep it around in a
singleton or global.

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