Hi,
I used the below ldif file to add a user defined objectclass in my openldap 2.4.40 on CentOS 7.
----------------------------------------------------------------------- dn: cn={12}ng911,cn=schema,cn=config changetype: add objectClass: olcSchemaConfig cn: ng911
dn: cn={12}ng911,cn=schema,cn=config changetype: modify add: olcAttributeTypes olcAttributeTypes: ( 1.3.6.1.4.1.42.2.27.4.1.6.8.12 NAME 'cityCode' DESC 'city plate' EQUALITY caseExactMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 ) olcAttributeTypes: ( 1.3.6.1.4.1.42.2.27.4.1.6.8.14 NAME 'identityNumber' DESC 'id number' EQUALITY caseExactMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 ) olcAttributeTypes: ( 1.3.6.1.4.1.42.2.27.4.1.6.8.16 NAME 'institutionName' DESC 'institution name' EQUALITY caseExactMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) olcAttributeTypes: ( 1.3.6.1.4.1.42.2.27.4.1.6.8.18 NAME 'phoneNumber' DESC 'phone' EQUALITY caseExactMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 ) olcAttributeTypes: ( 1.3.6.1.4.1.42.2.27.4.1.6.8.20 NAME 'agentId' DESC 'agent id' EQUALITY caseExactMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 ) olcAttributeTypes: ( 1.3.6.1.4.1.42.2.27.4.1.6.8.22 NAME 'agentPassword' DESC 'agent passwd' EQUALITY caseExactMatch SYNTAX 1.3.6.1.4.1.4203.1.1.2 ) - add: olcObjectClasses olcObjectClasses: ( 1.3.6.1.4.1.42.2.27.4.3.6 NAME 'ng911' DESC 'Container for ng911 object' SUP inetOrgPerson MAY ( cityCode $ identityNumber $ institutionName $ phoneNumber & agentId & agentPassword ) ) -----------------------------------------------------------------
And then I run the command on the server ldapmodify -Q -Y EXTERNAL -H ldapi:/// -f extendtong911.ldif
The addition was ok. But I made a mistake and run the same command again which added another copy of the objectclass. The result of the command below is given underneath it
ldapsearch -LLL -Y EXTERNAL -H ldapi:/// -b cn=schema,cn=config cn ----------------------------------------------------------------- dn: cn=schema,cn=config cn: schema
dn: cn={0}core,cn=schema,cn=config cn: {0}core
dn: cn={1}cosine,cn=schema,cn=config cn: {1}cosine
dn: cn={2}nis,cn=schema,cn=config cn: {2}nis
dn: cn={3}inetorgperson,cn=schema,cn=config cn: {3}inetorgperson
dn: cn={4}ng911,cn=schema,cn=config cn: {4}ng911 cn: {12}ng911
dn: cn={5}ng911,cn=schema,cn=config cn: {5}ng911 cn: {12}ng911 -----------------------------------------------------------------
Now, I want to delete the second objectclass created. For this I created an ldif file with the contents as below:
----------------------------------------------------------------- dn: cn={5}ng911,cn=schema,cn=config changetype: modify delete: olcObjectClasses olcObjectClasses: ( 1.3.6.1.4.1.42.2.27.4.3.6 NAME 'ng911' DESC 'Container for ng911 object' SUP inetOrgPerson MAY ( cityCode $ identityNumber $ institutionName $ phoneNumber & agentId & agentPassword ) ) -----------------------------------------------------------------
And I run the command ldapmodify -Q -Y EXTERNAL -H ldapi:/// -f deleteng911.ldif on the server. The result is: ----------------------------------------------------------------- modifying entry "cn={5}ng911,cn=schema,cn=config" ldap_modify: No such attribute (16) additional info: modify/delete: olcObjectClasses: no such attribute ----------------------------------------------------------------- When I change {5} to {12} I get ----------------------------------------------------------------- modifying entry "cn={12}ng911,cn=schema,cn=config" ldap_modify: No such object (32) matched DN: cn=schema,cn=config -----------------------------------------------------------------
I tried many modifications of the ldif file but couldn't succeed. Can you help me writing the right ldif file for deletion of an objectclass?
Thanks. Tamer