Skip to content

Bug when creating Active Directory group #90

@duboisst

Description

@duboisst

I try to create a group but I get the following error:

NoMethodError (undefined method `map' for 18400597803079440689678002902069631524796887079072566:Bignum):

Here is my ruby code to create a group

group_dn='cn=foo,ou=bar,dc=my,dc=company,dc=com'
groupname='foo'    
grouptype = 0x80000008
ldap_con = Net::LDAP.new({ :host => 'my_host', :port => 389, :encryption => nil, :auth => { :method => :simple, :username => 'my_username', :password => 'my_password' }})
ldap_con.open do |ldap|
      ldap.add(:dn => group_dn, :attributes => {:samaccountname => groupname,
                  :mailNickname => groupname,
                  :displayName => groupname,
                  :groupType => grouptype})
end

The error occurs only if I try to set the attribute :groupType, but if I don't set it the group is not created.

I have done some debugging and found that the issue occurs when the Initialize method of Net::LDAP::PDU calls parse_controls(ber_object[2])

def parse_controls(sequence)
    @ldap_controls = sequence.map do |control|
      o = OpenStruct.new
      o.oid, o.criticality, o.value = control[0], control[1], control[2]
      if o.criticality and o.criticality.is_a?(String)
        o.value = o.criticality
        o.criticality = false
      end
      o
    end
  end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions