Ruby/LDAP 0.9.4 released

I wasn’t planning another release of this package quite so quickly, but a user asked me how to restrict the number of results returned by the server, prompting me to ask myself, “Yeah, how do you do that?”

I quickly remembered how to set the number of results, but then discovered that this doesn’t actually help with Ruby/LDAP. The reason is because the server will return the status of LDAP_SIZELIMIT_EXCEEDED along with the search results when its maximum number of results has been exceeded. Ruby/LDAP had the unfortunate property of throwing an exception to the status LDAP_SIZELIMIT_EXCEEDED, as it does with any status that isn’t LDAP_SUCCESS. Any results obtained up until that point were discarded.

The 0.9.4 release corrects this problem in all search methods, to whit LDAP::Conn#search, LDAP::Conn#search2, LDAP::Conn#search_ext and LDAP::Conn#search_ext2. It’s now up to the user to check the error status after performing a search. This can be done by invoking LDAP::Conn#err. If that returns LDAP::LDAP_SIZELIMIT_EXCEEDED instead of LDAP::LDAP_SUCCESS, then the results set was truncated by the server. This allows users to request a tiny subset of results, so as to spare the server from unnecessary work. Of course, if you know your modern LDAP, you’ll know that the paged results control could be used to achieve the same goal, but fixing this issue makes for an easier alternative (and not all servers support the paged results control, anyway).

There are a couple of other minor changes in this release, but nothing user-visible.

You can obtain Ruby/LDAP via the project home page.

This entry was posted in Ruby. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *