From: Francis Cianfrocca Date: 2006-08-16T05:53:01+09:00 Subject: Re: [ANN] Net::LDAP 0.0.4 released ------=_Part_33790_11426004.1155675179153 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 8/15/06, Berger, Daniel wrote: > > > On 8/15/06, Berger, Daniel 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. ------=_Part_33790_11426004.1155675179153--