Berger, Daniel
8/15/2006 9:02:00 PM
> -----Original Message-----
> From: Francis Cianfrocca [mailto:garbagecat10@gmail.com]
> Sent: Tuesday, August 15, 2006 2:53 PM
> To: ruby-talk ML
> Subject: Re: [ANN] Net::LDAP 0.0.4 released
>
>
> On 8/15/06, Berger, Daniel <Daniel.Berger@qwest.com> wrote:
> >
> > > On 8/15/06, Berger, Daniel <Daniel.Berger@qwest.com> 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?
I'm afraid I can't say much more than it's a 3rd party solution.
> 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
Of course, thanks. I should have known that.
> 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.
Yep, thanks.
I'll be putting this into my Rails app this week to replace the ugly
system call + open3 solution I'm using now (ick).
Many thanks for this!
Dan
PS - The ruby-ldap (C extension) library causes Ruby to segfault in
combination with WEBrick, in case you're wondering why I didn't use that
instead.
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.