Ldap – Unable to add schema in OpenLDAP using run-time configuration cn=config

ldapopenldapschema

I have the following ldif file which I am trying to load into openLDAP:

Custom schema being created for the Monas project

dn: cn=testSchemas,cn=schema,cn=config
objectClass: olcSchemaConfig
cn: testSchemas
olcAttributeTypes ( 1.3.6.1.4.1.4203.666.1.90 
 NAME 'competence'
 DESC 'The field an individual is qualified'
 EQUALITY caseIgnoreMatch
 SUBSTR caseIgnoreSubStringsMatch
 SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128} )

olcAttributeTypes ( 1.3.6.1.4.1.4203.666.1.91 
 NAME 'spokenLanguage'
 DESC 'The language spoken by a person.'
 SUP preferredLanguage
 EQUALITY caseIgnoreMatch
 SUBSTR caseIgnoreSubStringsMatch
 SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256} )

olcObjectClasses ( 1.3.6.1.4.1.4203.666.2012.1 
 NAME 'inetOrgTestPerson'
 DESC 'An extension of the inetOrgPerson objectClass to add some additional attributes'
 SUP inetOrgPerson
 STRUCTURAL
 MUST competence
 MAY spokenLanguage )

I keep geting the error: ldapadd: invalid format (line 4) entry: cn=testSchemas,cn=schema,cn=config" and I can't figure out for the life of me what's wrong. I am on ubuntu 12.04 with openldap 2.4.28

Edit:
After fixing the syntatic error of the missing ':', I managed to add the object and attributes (or so I thought) but I can't see them when I execute a search I get the error:

ldap_modify: Type or value exists (20)
    additional info: modify/add: olcAttributeTypes: value #0 already exists

when I try to add the objects again which means they're in the db, but nothing turns up in search.

Best Answer

From what I can see in your LDIF you are missing the colon (:) after the olcAttributeTypes and olcObjectClasses keywords. Should look like this:

olcAttributeTypes: ( 1.3.6.1.4.1.4203.666.1.90
  NAME 'competence'
  ...