Mandatory Active Directory attributes from LDAP

Cannot create AD entry from LDAP because I'm missing mandatory attributes.

2019/02/08 15:50:29 LDAP Result Code 65 "Object Class Violation": 00002077: UpdErr: DSID-03051277, problem 6002 (OBJ_CLASS_VIOLATION), data 0

This error is given when you are missing or trying to add an incorrect attribute value.

I'm using the gopkg.in/ldap.v3 library in golang. I can delete entries so the connection is fine but I cannot add them. This is the list of attributes I'm adding:

ar.Attribute("cn", []string{"test"})
ar.Attribute("instanceType", []string{"4"})
// ar.Attribute("nTSecurityDescriptor", []string{"user@example.org"})
ar.Attribute("objectCategory", []string{"CN=Person,CN=Schema,CN=Configuration,DC=sfh,DC=microlab-eindhoven,DC=nl"})
ar.Attribute("objectClass", []string{"organizationalPerson"})
ar.Attribute("objectClass", []string{"person"})
ar.Attribute("objectClass", []string{"top"})
ar.Attribute("objectClass", []string{"user"})
// ar.Attribute("objectGUID", []string{"user@example.org"})
// ar.Attribute("objectSid", []string{"user@example.org"})
ar.Attribute("sAMAccountName", []string{"test"})
ar.Attribute("givenName", []string{"test"})
ar.Attribute("displayName", []string{"test"})
ar.Attribute("userPassword", []string{"test"})
ar.Attribute("userPrincipalName", []string{"test"})
ar.Attribute("sAMAccountName", []string{"test"})

1 answer

  • answered 2019-02-08 15:10 Trody

    It has to be like this:

    ar.Attribute("objectClass", []string{"organizationalPerson","person","top","user"})