我试图设置一个LDIF文件,该文件将向现有节点添加新的属性值。该属性是自定义对象类的强制属性。
以下是LDIF文件的内容" add.ldif':
dn: cn=hna,cn=Users,DC=lan,DC=test,DC=de
changetype: modify
add: objectclass
objectclass: MyCustomObjectClass
-
add: myCustomAttribute
myCustomAttribute: someValue
-
问题:当我尝试使用
将其添加到LDAP服务器时ldapmodify -h ... -D ... -w ... -x -f add.ldif
我收到错误消息
ldap_modify: Objectclass violation (65)
additional info: 00002014: objectclass_attrs: attribute 'myCustomAttribute'
on entry 'cn=hna,cn=Users,DC=lan,DC=test,DC=de' does not exist in the
specified objectclasses
当我遗漏“添加' ' myCustomAtribute'然后我当然得到:
ldap_modify: Objectclass violation (65)
additional info: 00002014: objectclass_attrs: at least one mandatory attribute
('myCustomAttribute') on entry 'cn=hna,cn=Users,DC=lan,DC=test,DC=de'
wasn't specified!
知道我的做法有什么问题吗?
ldapmodify是来自OpenLDAP的;服务器是Samba V4 LDAP。
答案 0 :(得分:0)
这应该有效:
dn: cn=hna,cn=Users,DC=lan,DC=test,DC=de
changetype: modify
add: objectclass
objectclass: MyCustomObjectClass
add: myCustomAttribute
myCustomAttribute: someValue
最后一行后面必须有一个空行。 " - "仅当您想要执行单独的修改操作并使它们成为原子时才需要。 (即所有工作或全部失败)。
添加objectclass需要MUST属性必须在同一修改中发生。
顺便提一下,我注意到一些ldapmodify程序没有正确处理这些。
-Jim