是否有可能使inetOrgPerson成为posixgroup的成员而不是在cn中添加手动条目,我使用php和ldap,但我似乎遇到了这个:
Modify: Object class violation
代码:
$ldap = ldap_connect("localhost") or die("Unable to connect to server.");
ldap_set_option($ldap,LDAP_OPT_PROTOCOL_VERSION,3);
$dn = "cn=admin,dc=*******,dc=com";
ldap_bind($ldap,$dn,"*****") or die("Unable to connect to server..");
$dn = "cn=********,cn=*********,cn=*********,ou=A*******,dc=********,dc=com";
$entry["cn"] = "MerPaul";
$entry["objectClass"] = "inetOrgPerson";
ldap_mod_add($ldap,$dn,$entry);
我做错了什么?
答案 0 :(得分:2)
LDAP中的objectClass具有可选和必填字段。 inetOrgPerson也不例外。
inetOrgPerson的必填字段为sn
和cn
。
$entry["cn"] = "MerPaul";
$entry["sn"] = "Joe"
$entry["objectClass"] = "inetOrgPerson";
ldap_mod_add($ldap,$dn,$entry);