From: Francis Cianfrocca Date: 2006-05-06T11:20:51+09:00 Subject: Re: Ruby-LDAP and leftover connections ------=_Part_1705_30650560.1146882048608 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I'm assuming you're using the Ruby-LDAP library that wraps up the native client libraries. These libraries have behavior with respect to the network that is hard to predict. In particular, unbinding doesn't necessary drop th= e network connection. I'm not knowledgeable enough to say whether Ruby's GC interacts with this, although that's an interesting possibility. Another really weird one is if you should have an unsuccessful binding: on Linux, this will often cause the native LDAP library to leak a TCP connection, eve= n if you properly destruct the library-level object. Very frustrating, I know about that one from very painful experience. I took a shot at writing a pure-Ruby LDAP client that would have much better-defined semantics with regard to the network, Try it, it's called ruby-net-ldap on Rubyforge. If you do try it, please let me know if it work= s any better for you. On 5/5/06, Sean Hussey wrote: > > Hi all, > > I'm using RubyLDAP all over the place in my Rails app. I'm curious, > though, if I'm not specifically unbinding in certain places, are the > connections kept open? > > Also, assuming I've subclassed LDAP::Conn to provide a class specific > to our LDAP here, will this leave a bound connection hanging? > > def check_password(userdn, password) > return OurLDAP.new.bind.compare(userdn, "userpassword", password) > end > > Basically, I just want to check and make sure the password is valid. > OurLDAP.new.bind binds as a user that can compare on that attribute. > Am I leaving a connection open? > > Thanks! > > Sean > > ------=_Part_1705_30650560.1146882048608--