仅使用ObjectID从ldap中删除objectsClasses和attributeTypes

时间:2015-04-24 21:23:45

标签: ldap opendj

我一直在尝试通过脚本从本地openDJ实例中删除objectsClasses和attributeTypes。目标是创建一组脚本来销毁然后重新创建服务器,这样当发生更改时,每个开发人员/实例都可以简单地运行脚本并准备就绪。我已成功使用完整定义删除objests和属性,但是当我尝试使用ObjectID时,它无法找到对象/属性。 "Entry cn=schema cannot be modified because the attempt to update objectClasses would have removed one or more values from the attribute that were not present: (1.1.2.2.2) "

工作ldif:

dn: cn=schema
changetype: modify
delete: objectClasses
objectclasses: ( 1.1.2.2.2 NAME 'tstPerson'
            DESC 'Person object'
            SUP inetOrgPerson
            STRUCTURAL
            MUST ( name )
            MAY ( unit ) 
             ) 

dn: cn=schema
changetype:modify
delete:attributeTypes
attributeTypes: (2.16.3.1.1
   NAME 'unit'
   DESC 'identifies the unit or units a person has been assigned'
   EQUALITY caseIgnoreMatch
   SUBSTR caseIgnoreSubstringsMatch
   SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )

缩短非工作:

dn: cn=schema
changetype: modify
delete: objectClasses
objectclasses: ( 1.1.2.2.2 ) 

dn: cn=schema
changetype:modify
delete:attributeTypes
attributeTypes: ( 2.16.3.1.1 )

问题是,为了删除objectClass或属性,是否需要提供objectClass或属性的完整定义,或者是否有办法专门标识具有名称或OID的objectClass或属性?

1 个答案:

答案 0 :(得分:0)

刚刚检查过它只适用于OID和名称。

$ ldapmodify -D cn=directory\ manager -w secret12 -p 1389
dn: cn=schema
changetype: modify
delete: attributeTypes
attributeTypes: (2.16.3.1.1 NAME 'unit')

Processing MODIFY request for cn=schema
MODIFY operation successful for DN cn=schema

我需要验证为什么只有OID是不够的,但这应该可以帮助你继续前进