Problem connecting with ruby-net-ldap - Net::BER::BerError

Discussion in 'Ruby' started by Daniel Berger, Oct 22, 2007.

  1. Hi all,

    Ruby 1.8.6
    Windows XP Pro
    ruby-net-ldap 0.0.4

    I'm getting a strange error when I try this simple script, where
    LDAP_SERVER is a 3rd party ldap server:

    ldap = Net::LDAP.new:)host => LDAP_SERVER, :port => 9999)
    ldap.bind:)dn => 'cn=Admin', :password => 'xxx')
    ldap.unbind

    /lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ber.rb:117:in
    `read_ber': unsupported object type: class=contextspecific,
    encoding=primitive, tag=7 (Net::BER::BerError)
    from C:/ruby/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/
    ber.rb:112:in `read_ber'
    from C:/ruby/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/
    ldap.rb:1104:in `bind'
    from C:/ruby/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/
    ldap.rb:701:in `bind'
    from user.rb:26

    Any ideas?

    Thanks,

    Dan
    Daniel Berger, Oct 22, 2007
    #1
    1. Advertising

  2. On Oct 22, 2:00 pm, "Francis Cianfrocca" <>
    wrote:
    > On 10/22/07, Daniel Berger <> wrote:
    >
    > > Hi all,

    >
    > > Ruby 1.8.6
    > > Windows XP Pro
    > > ruby-net-ldap 0.0.4

    >
    > > I'm getting a strange error when I try this simple script, where
    > > LDAP_SERVER is a 3rd party ldap server:

    >
    > > ldap = Net::LDAP.new:)host => LDAP_SERVER, :port => 9999)
    > > ldap.bind:)dn => 'cn=Admin', :password => 'xxx')
    > > ldap.unbind

    >
    > > /lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ber.rb:117:in
    > > `read_ber': unsupported object type: class=contextspecific,
    > > encoding=primitive, tag=7 (Net::BER::BerError)
    > > from C:/ruby/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/
    > > ber.rb:112:in `read_ber'
    > > from C:/ruby/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/
    > > ldap.rb:1104:in `bind'
    > > from C:/ruby/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/
    > > ldap.rb:701:in `bind'
    > > from user.rb:26

    >
    > Dan, try syncing to the head revision of the library, there are a handful of
    > changes not in the current release. If that doesn't solve the problem, then
    > I'll look into it more closely for you.


    Hi Francis,

    Hm, something's wacky with your SCM repository. RF says you're using
    Subversion. All I see under trunk, however, is a bunch of CVSROOT
    files. What am I supposed to grab? The stuff under the
    experimental_netldap branch?

    Thanks,

    Dan
    Daniel Berger, Oct 22, 2007
    #2
    1. Advertising

  3. On Oct 22, 2:32 pm, "Francis Cianfrocca" <>
    wrote:
    > On 10/22/07, Daniel Berger <> wrote:
    >
    >
    >
    > > > Dan, try syncing to the head revision of the library, there are a

    > > handful of
    > > > changes not in the current release. If that doesn't solve the problem,

    > > then
    > > > I'll look into it more closely for you.

    >
    > > Hi Francis,

    >
    > > Hm, something's wacky with your SCM repository. RF says you're using
    > > Subversion. All I see under trunk, however, is a bunch of CVSROOT
    > > files. What am I supposed to grab? The stuff under the
    > > experimental_netldap branch?

    >
    > Yes, sorry about that, it's under branches/experimental_netldap. I came into
    > that project in midstream and didn't want to disturb the existing code, so I
    > added that branch.
    >
    > I know I supported some more of the BER types when I added SNMP support to
    > that library a few months back, so I'm hopeful this will solve your problem.


    Ok. Now I'm seeing this (same code as before):

    C:\Documents and Settings\djberge\workspace\ruby-cramer\lib
    \cramer>ruby user.rb
    C:/ruby/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.1.0/lib/net/ldap.rb:
    1238:in `bind': unsupported auth method () (Net::LDAP
    ::LdapError)
    from C:/ruby/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.1.0/lib/
    net/ldap.rb:730:in `bind'
    from user.rb:26

    Any ideas? Did I botch the install somehow?

    Regards,

    Dan
    Daniel Berger, Oct 22, 2007
    #3
  4. On Oct 22, 3:25 pm, Daniel Berger <> wrote:
    > On Oct 22, 2:32 pm, "Francis Cianfrocca" <>
    > wrote:
    >
    >
    >
    > > On 10/22/07, Daniel Berger <> wrote:

    >
    > > > > Dan, try syncing to the head revision of the library, there are a
    > > > handful of
    > > > > changes not in the current release. If that doesn't solve the problem,
    > > > then
    > > > > I'll look into it more closely for you.

    >
    > > > Hi Francis,

    >
    > > > Hm, something's wacky with your SCM repository. RF says you're using
    > > > Subversion. All I see under trunk, however, is a bunch of CVSROOT
    > > > files. What am I supposed to grab? The stuff under the
    > > > experimental_netldap branch?

    >
    > > Yes, sorry about that, it's under branches/experimental_netldap. I came into
    > > that project in midstream and didn't want to disturb the existing code, so I
    > > added that branch.

    >
    > > I know I supported some more of the BER types when I added SNMP support to
    > > that library a few months back, so I'm hopeful this will solve your problem.

    >
    > Ok. Now I'm seeing this (same code as before):
    >
    > C:\Documents and Settings\djberge\workspace\ruby-cramer\lib
    > \cramer>ruby user.rb
    > C:/ruby/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.1.0/lib/net/ldap.rb:
    > 1238:in `bind': unsupported auth method () (Net::LDAP
    > ::LdapError)
    > from C:/ruby/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.1.0/lib/
    > net/ldap.rb:730:in `bind'
    > from user.rb:26
    >
    > Any ideas? Did I botch the install somehow?


    I think it's a code problem. I added this line at 1231:

    meth ||= :simple

    But now I get this error:

    user.rb:28: undefined method `unbind' for #<Net::LDAP:0x2760280>
    (NoMethodError)

    I think there's something fundamentally broken with ldap.rb now, but I
    couldn't tell you what it is.

    Regards,

    Dan
    Daniel Berger, Oct 22, 2007
    #4
  5. On Oct 22, 3:55 pm, "Francis Cianfrocca" <>
    wrote:
    > On 10/22/07, Daniel Berger <> wrote:
    >
    >
    >
    > > Hi all,

    >
    > > Ruby 1.8.6
    > > Windows XP Pro
    > > ruby-net-ldap 0.0.4

    >
    > > I'm getting a strange error when I try this simple script, where
    > > LDAP_SERVER is a 3rd party ldap server:

    >
    > > ldap = Net::LDAP.new:)host => LDAP_SERVER, :port => 9999)
    > > ldap.bind:)dn => 'cn=Admin', :password => 'xxx')
    > > ldap.unbind

    >
    > Try this instead:
    >
    > ldap.bind:)method=>:simple, :dn => 'cn=Admin', :password => 'xxx')


    Ok, so it seems the bind did work. But now I get this:

    user.rb:28: undefined method `unbind' for #<Net::LDAP:0x2760258>
    (NoMethodError)

    Strange. Any ideas?

    Regards,

    Dan
    Daniel Berger, Oct 22, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason Wold

    using LDAP Controls in ruby-ldap

    Jason Wold, Nov 4, 2004, in forum: Ruby
    Replies:
    5
    Views:
    231
  2. Ian Macdonald
    Replies:
    0
    Views:
    207
    Ian Macdonald
    Mar 15, 2005
  3. Replies:
    1
    Views:
    194
    Austin Ziegler
    Oct 11, 2006
  4. Francis Cianfrocca
    Replies:
    3
    Views:
    183
    Edwin Fine
    Dec 9, 2006
  5. dacat

    Net::LDAP vs ruby/ldap

    dacat, Apr 27, 2007, in forum: Ruby
    Replies:
    3
    Views:
    283
    Ian Macdonald
    May 18, 2007
Loading...

Share This Page