LDAP 错误:结构对象类链无效(organizationalUnit/referral)

发布于 2024-12-27 21:14:38 字数 1696 浏览 2 评论 0原文

我正在尝试从 Oracle 的 JNDI 教程 在我的 OpenLDAP 实例中使用命令:

ldapadd -x -D cn=admin,dc=example,dc=com -W -f refserver.ldif

where, refserver.ldif 看起来像这样:

dn: o=JNDITutorial,dc=example,dc=com
o: JNDITutorial
objectclass: top
objectclass: organization

dn: ou=All, o=JNDITutorial,dc=example,dc=com
ou: All
objectclass: top
objectclass: organizationalunit

dn: ou=People, o=JNDITutorial,dc=example,dc=com
ou: People
objectclass: top
objectclass: organizationalunit
objectclass: referral
ref: ldap://10.97.98.201:389/ou=People,o=JNDITutorial

dn: ou=People, ou=All, o=JNDITutorial,dc=example,dc=com
ou: People
objectclass: top
objectclass: organizationalunit
objectclass: referral
ref: ldap://10.97.98.201:389/ou=People,o=JNDITutorial

dn: ou=NewHires, ou=All, o=JNDITutorial,dc=example,dc=com
ou: NewHires
objectclass: top
objectclass: organizationalunit
objectclass: referral
ref: ldap://10.97.98.201:389/ou=NewHires,o=JNDITutorial

这会部分成功,报告以下内容:

adding new entry "o=JNDITutorial,dc=example,dc=com"

adding new entry "ou=All, o=JNDITutorial,dc=example,dc=com"

adding new entry "ou=People, o=JNDITutorial,dc=example,dc=com"
ldap_add: Object class violation (65)
    additional info: invalid structural object class chain (organizationalUnit/referral)

我正在尝试从 此处。但是,原因和解决方案对我来说有点不清楚。有人可以阐明这一点并提出补救措施吗?

提前致谢!

I am trying to import the following sample from Oracle's JNDI tutorial in my OpenLDAP instance using command:

ldapadd -x -D cn=admin,dc=example,dc=com -W -f refserver.ldif

where, refserver.ldif looks like this:

dn: o=JNDITutorial,dc=example,dc=com
o: JNDITutorial
objectclass: top
objectclass: organization

dn: ou=All, o=JNDITutorial,dc=example,dc=com
ou: All
objectclass: top
objectclass: organizationalunit

dn: ou=People, o=JNDITutorial,dc=example,dc=com
ou: People
objectclass: top
objectclass: organizationalunit
objectclass: referral
ref: ldap://10.97.98.201:389/ou=People,o=JNDITutorial

dn: ou=People, ou=All, o=JNDITutorial,dc=example,dc=com
ou: People
objectclass: top
objectclass: organizationalunit
objectclass: referral
ref: ldap://10.97.98.201:389/ou=People,o=JNDITutorial

dn: ou=NewHires, ou=All, o=JNDITutorial,dc=example,dc=com
ou: NewHires
objectclass: top
objectclass: organizationalunit
objectclass: referral
ref: ldap://10.97.98.201:389/ou=NewHires,o=JNDITutorial

This runs into partial success, reporting the following:

adding new entry "o=JNDITutorial,dc=example,dc=com"

adding new entry "ou=All, o=JNDITutorial,dc=example,dc=com"

adding new entry "ou=People, o=JNDITutorial,dc=example,dc=com"
ldap_add: Object class violation (65)
    additional info: invalid structural object class chain (organizationalUnit/referral)

I am trying to read up the cause from here. However, the cause and solution is a bit unclear to me. Can someone please shed some light on this and suggest remedy?

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

胡渣熟男 2025-01-03 21:14:38

解释很简单,当您在 LDAP 目录中创建对象时,该对象必须具有SINGLE结构类。在您的例子中,您提到了两个结构类organizationalunitreferal

完成您想做的事情的正确方法是使用结构类和辅助类。

extensibleObject 是一个辅助类,它允许您使用您想要的任何属性。

这是一个示例

dn: ou=MyOU,ou=Monou,dc=societe,dc=com
objectClass: referral
objectClass: top
objectClass: extensibleObject
ou: MyOU
ref:: bGRhcDovLzEwLjk3Ljk4LjIwMTozODkvb3U9UGVvcGxlLG89Sk5ESVR1dG9yaWFsIA==

备注:在这里您可以看到 LDAP URL 是用 base64 编码的(由 :: 引入),最好采用 LDIF 格式。 Apache Directory Studio 是一个开源产品,允许您以图形方式测试 OpenLdap(您将在里面找到B64 转换器),该工具可以生成您的 LDIF 文件。

在此处输入图像描述

The explanation is very simple, when you create an object in a LDAP directory, this object MUST be with a SINGLE structural class. In your case you mention two structural classes organizationalunit and referal.

A correct way to do what you want to do is to use a structural class and an auxiliary class.

extensibleObject is an auxiliary class that allow you to use any attribute you want.

Here is a sample

dn: ou=MyOU,ou=Monou,dc=societe,dc=com
objectClass: referral
objectClass: top
objectClass: extensibleObject
ou: MyOU
ref:: bGRhcDovLzEwLjk3Ljk4LjIwMTozODkvb3U9UGVvcGxlLG89Sk5ESVR1dG9yaWFsIA==

Remark : here you can see that the LDAP URL is coded in base64 (introduced by ::) it's better to do so in LDIF format. Apache Directory Studio is an open source product that allow you to test your OpenLdap graphicaly (you'll find inside a B64 converter), this tool can generate your LDIF files.

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文