Ruby net/ldap, LDAP PDU error

I have a problem here. I am trying to connect to a LDAP server (IBM’s
Tivoli to be exact) to automate a process that will export the schema in
LDIF format. I am able to bind to Active directory with no problems
using the standard example.

Versions: Ruby 1.8.6 patchlevel 287 Ruby-net-ldap 0.0.4 rubygems 1.3.5

ldap = Net::LDAP.new( :host => server, :port => ADSettings.port,
:encryption => :simple_tls)

ldap.authenticate ADSettings.username, ADSettings.password

if ldap.bind

success

else

failed

end

However when I attempt to bind to this Tivoli server, I get the
following.

C:/Ruby/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/pdu.rb:80:in
`initialize’: ldap-pdu format error (Net::LdapPd
uError)

Here is my sample script.

require ‘rubygems’
require ‘net/ldap’

binddn = “uid=admin,dc=company,dc=com”
bindpass = ‘password’

ldap = Net::LDAP.new( :host => ‘’,:port => 11636,
:auth => {:method => :simple, :username => binddn,:password =>
bindpass})

ldap_filter = Net::LDAP::Filter.eq(“objectClass”,“LdapGroup”)
ldap.bind

ldap.search(:base => “dc=company,dc=com”,:filter => ldap_filter) do
|entry|
puts “Entry == #{entry.inspect}”
end
As soon as it evalutes ldap.bind I get the PDU error. I’ve tried this in
IRB as well with the same result.

I can open openssl and run the following and it appears the SSL
handshake occurs without a problem.

OpenSSL> s_client -connect ldapserver:11636
Any help is appreciated and I’ll provide anything else I can. I’m
unfortunately stuck with Ruby 1.8.6(can’t upgrade) and accompanying
gems. long story there.

I can also bind to the non SSL port 389 without a problem.

bump

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs