0

I am new to OpenLDAP administration. My aim is to learn how to create custom schemas, and customize "my" directory server this way.

I tried to add one optional attribute - ipPhone. Made a schema (dummy) then converted it to the below LDIF file:

dn: cn=dummy,cn=schema,cn=config
changetype: add
objectClass: olcSchemaConfig
cn: dummy
dn: cn=dummy,cn=schema,cn=config

changetype: modify
#changetype: add
add: olcAttributeTypes
olcAttributeTypes: {0}( 1.3.6.1.4.1.4203.666.100.123 NAME 'ipPhone'
DESC 'ip telephone internal or routable number' SUP telephoneNumber )
-
add: olcObjectClasses
olcObjectClasses: {0}( 1.3.6.1.4.1.4203.666.100.1 NAME 'dummyPerson'
DESC 'Dummy-server user' SUP inetOrgPerson STRUCTURAL MAY ipPhone )

When I try to add this schema using ldapmodify(1), I get the below error:

modifying entry "cn=dummy,cn=schema,cn=config"
ldap_modify: No such object (32)
matched DN: cn=schema,cn=config

What did I do wrong? Also, where can I read-up about "changetype"? I am unsure where to use "modify" or "add" for my LDIF.

Thank you.

Moshe Shmukler
  • 207
  • 1
  • 8

1 Answers1

0

changetype is global for the whole entry. It is required a single changetype below the dn: in your example 'add' is correct as the dn didn't exist in directory before.

Then you have to stack the couples:

attribute_type: attribute_value

The add, replace or delete keywords are out-of-place here: they are expected with a changetype: modify; for the same reason the dash (-) to divide attributes is misplaced ad well.

The whole ldif would look like:

 dn: cn=dummy,cn=schema,cn=config
 changetype: add       
 cn: dummy
 objectClass: olcSchemaConfig
 olcAttributeTypes: {0}( 1.3.6.1.4.1.4203.666.100.123 NAME 'ipPhone'
  DESC 'ip telephone internal or routable number' SUP telephoneNumber )
 olcObjectClasses: {0}( 1.3.6.1.4.1.4203.666.100.1 NAME 'dummyPerson'
  DESC 'Dummy-server user' SUP inetOrgPerson STRUCTURAL MAY ipPhone )