# Net::LDAP 0.0.1

**URL:** <https://www.ruby-forum.com/t/net-ldap-0-0-1/59363>\
**Category:** Ruby\
**Created:** [May 3, 2006, 6:58pm UTC](https://www.ruby-forum.com/t/net-ldap-0-0-1/59363 "2006-05-03T18:58:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![blackhedd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9de053/32.png) [@blackhedd](https://www.ruby-forum.com/u/blackhedd)\
**Post date:** [May 3, 2006, 6:58pm UTC](https://www.ruby-forum.com/t/net-ldap-0-0-1/59363/1 "2006-05-03T18:58:35Z")

</div>

We’re pleased to announce the first release of Net::LDAP, the first  
pure-Ruby LDAP library. Net::LDAP intends to be a feature-complete  
LDAP client which can access as much as possible of the functionality  
of the most-used LDAP server implementations. This library does  
not wrap any existing native-code LDAP libraries, creates no  
Ruby extensions, and has no dependencies external to Ruby.

Net::LDAP includes a full implementation of the LDAP wire-line  
protocol so it can also be used in LDAP server implementations.

Thanks for Austin Z. for invaluable help in reviewing the  
implementation and providing the release structure.

= What is Net::LDAP for Ruby?  
This library provides a pure-Ruby implementation of an LDAP client.  
It can be used to access any server which implements the LDAP protocol.

Net::LDAP is intended to provide full LDAP functionality while hiding  
the more arcane aspects of the LDAP protocol itself, so as to make the  
programming interface as Ruby-like as possible.

In particular, this means that there is no direct dependence on the  
structure of the various “traditional” LDAP clients. This is a ground-up  
rethinking of the LDAP API.

Net::LDAP is based on RFC-1777, which specifies the Lightweight  
Directory  
Access Protocol, as amended and extended by subsequent RFCs and by the  
more  
widely-used directory implementations.

Homepage:: [http://rubyforge.org/projects/net-ldap/](http://rubyforge.org/projects/net-ldap/)  
Download:: [http://rubyforge.org/frs/?group\_id=143](http://rubyforge.org/frs/?group_id=143)  
Copyright:: 2006 by Francis C.

== LICENCE NOTES  
Please read the file LICENCE for licensing restrictions on this library.  
In  
the simplest terms, this library is available under the same terms as  
Ruby  
itself.

== Requirements and Installation  
Net::LDAP requires Ruby 1.8.2 or better.

Net::LDAP can be installed with:

% ruby setup.rb

Alternatively, you can use the RubyGems version of Net::LDAP available  
as ruby-net-ldap-0.0.1.gem from the usual sources.

== Whet your appetite:  
require ‘net/ldap’

```
ldap = Net::LDAP.new :host => server_ip_address,
     :port => 389,
     :auth => {
           :method => :simple,
           :username => "cn=manager,dc=example,dc=com",
           :password => "opensesame"
     }

filter = Net::LDAP::Filter.eq( "cn", "George*" )
treebase = "dc=example,dc=com"

ldap.search( :base => treebase, :filter => filter ) do |entry|
  puts "DN: #{entry.dn}"
  entry.each do |attribute, values|
    puts " #{attribute}:"
    values.each do |value|
      puts " --->#{value}"
    end
  end
end

p ldap.get_operation_result

```

== Net::LDAP 0.0.1: May 1, 2006

- Initial release.
- Client functionality is near-complete, although the APIs  
are not guaranteed and may change depending on feedback  
from the community.
- We’re internally working on a Ruby-based implementation  
of a full-featured, production-quality LDAP server,  
which will leverage the underlying LDAP and BER functionality  
in Net::LDAP.
- Please tell us if you would be interested in seeing a public  
release of the LDAP server.
- Grateful acknowledgement to Austin Z., who reviewed  
this code and provided the release framework, including  
minitar.

---

<div class="post-metadata">

**Author:** ![blackhedd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9de053/32.png) [@blackhedd](https://www.ruby-forum.com/u/blackhedd)\
**Post date:** [May 3, 2006, 6:58pm UTC](https://www.ruby-forum.com/t/net-ldap-0-0-1/59363/2 "2006-05-03T18:58:37Z")

</div>

On 5/1/06, Francis C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> We’re pleased to announce the first release of Net::LDAP, the first  
> pure-Ruby LDAP library. Net::LDAP intends to be a feature-complete  
> LDAP client which can access as much as possible of the functionality  
> of the most-used LDAP server implementations. This library does  
> not wrap any existing native-code LDAP libraries, creates no  
> Ruby extensions, and has no dependencies external to Ruby.
> 
> Net::LDAP includes a full implementation of the LDAP wire-line  
> protocol so it can also be used in LDAP server implementations.

Thank you thank you thank you thank you.

Do you mind if I ask how long this has been in development? The code  
comments look like the best I’ve seen in any open-source LDAP  
implementation.

---

<div class="post-metadata">

**Author:** ![blackhedd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9de053/32.png) [@blackhedd](https://www.ruby-forum.com/u/blackhedd)\
**Post date:** [May 3, 2006, 6:58pm UTC](https://www.ruby-forum.com/t/net-ldap-0-0-1/59363/3 "2006-05-03T18:58:40Z")

</div>

Started working on this about two weeks ago. Spent about a week working  
on  
it.

---

<div class="post-metadata">

**Author:** ![blackhedd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9de053/32.png) [@blackhedd](https://www.ruby-forum.com/u/blackhedd)\
**Post date:** [May 3, 2006, 6:58pm UTC](https://www.ruby-forum.com/t/net-ldap-0-0-1/59363/4 "2006-05-03T18:58:40Z")

</div>

You are the man. This blows what Python and Perl have out of the  
water, in my opinion.

---

<div class="post-metadata">

**Author:** ![blackhedd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9de053/32.png) [@blackhedd](https://www.ruby-forum.com/u/blackhedd)\
**Post date:** [May 3, 2006, 6:58pm UTC](https://www.ruby-forum.com/t/net-ldap-0-0-1/59363/5 "2006-05-03T18:58:43Z")

</div>

Well, light it up, give it a try, and tell me what you think should be  
different! 🙂  
I’m especially interested in any problems people may have with Active  
Directory. This was tested heavily against Unix servers. We know about  
the  
1000-entry limitation on A/D queries. That will be fixed shortly.

---

<div class="post-metadata">

**Author:** ![blackhedd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9de053/32.png) [@blackhedd](https://www.ruby-forum.com/u/blackhedd)\
**Post date:** [May 3, 2006, 6:59pm UTC](https://www.ruby-forum.com/t/net-ldap-0-0-1/59363/6 "2006-05-03T18:59:17Z")

</div>

Yes, that’s precisely the plan: the point of writing an LDAP server in  
Ruby  
is that it would be so easy to extend, particularly by feeding it from  
dynamic data. We have a particular interest in aggregating multiple  
directories on the fly, and also augmenting directory entries with  
real-time  
presence data. We already do this in C++ on another project, but Ruby is  
just so much nicer.

---

<div class="post-metadata">

**Author:** ![blackhedd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9de053/32.png) [@blackhedd](https://www.ruby-forum.com/u/blackhedd)\
**Post date:** [May 3, 2006, 6:59pm UTC](https://www.ruby-forum.com/t/net-ldap-0-0-1/59363/7 "2006-05-03T18:59:14Z")

</div>

Quoting removed\_email\_address@domain.invalid, on Tue, May 02, 2006 at 06:00:28AM  
+0900:

> - Please tell us if you would be interested in seeing a public  
> release of the LDAP server.

I would use an ldap server if it was toolkit for dynamic resolution of  
ldap queries.

I have ruby code to read the OS X AddressBook database, but there is no  
way to share that info to other AddressBook users.

I could write an LDAP server that published address info from my address  
book to the local network using LDAP, and others using AddessBook could  
subscribe to it. Very handy. Probably work cross platform with many  
different kind of apps. Why should you have to hire a sysadmin just to  
share your address book? Drives me nuts, but there are lots of client  
libraries for LDAP around… not so many servers.

If you do make a server, I don’t know your plan, but maybe you can keep  
use cases that involve serving dynamic data in mind - more like webrick  
and less like slapd written in ruby.

Cheers,  
Sam
