ruby-ldap / ruby-net-ldap

Pure Ruby LDAP library
https://rubygems.org/gems/net-ldap
Other
399 stars 253 forks source link

ldapserver.rb: Unsupported object type: id=96 (Net::BER::BerError) #378

Closed dup2 closed 4 years ago

dup2 commented 4 years ago

I'm trying to use your testserver as the base for project to support some simple ldap queries.

However, with every client (ldapsearch and this ruby net-ldap library) I always get the following exception on the server which then terminates: net-ldap-0.16.2/lib/net/ber/ber_parser.rb:93:in `parse_ber_object': Unsupported object type: id=96 (Net::BER::BerError)

Any ideas about this?

tatsuya-ogawa commented 4 years ago

LdapServerAsnSyntax need compiled. So please try to replace LdapServerAsnSyntax like this

LdapServerAsnSyntax = Net::BER.compile_syntax(
      {
          :application => {
              :constructed => {
                  0 => :array, # LDAP BindRequest
                  3 => :array # LDAP SearchRequest
              },
              :primitive => {
                  2 => :string, # ldapsearch sends this to unbind
              },
          },
          :context_specific => {
              :primitive => {
                  0 => :string, # simple auth (password)
                  7 => :string # present filter
              },
              :constructed => {
                  3 => :array # equality filter
              },
          },
      }
  )
dup2 commented 4 years ago

Thanks, that worked!