[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Problem with PHP/LDAP



>$ldap_bind = ldap_bind ($ldap_conn, $ldap_manager_dn, $ldap_password);
>     $info ["objectClass"] = "person";    #ok
>     $info ["uid"] = "pippo";
>     $info ["cn"] = "pippo";              #ok
>     $info ["sn"] = "pippo";              #ok
>     $info ["objectClass"] = "person";
>     $info ["objectClass"] = "account";
>     $info ["objectClass"] = "posixAccount";
>     $info ["objectClass"] = "top";
>     $info ["userPassword"] =
> "{crypt}$1$a0811139$/xUzQIdsvChM1.mhBZx6j/";
>     $info ["loginShell"] = "/bin/bash";
>     $info ["uidNumber"] = "505";
>     $info ["gidNumber"] = "505";
>     $info ["homeDirectory"] = "/home/pippo";
>  
>     $ldap_bind = ldap_add ($ldap_conn, "cn=pippo, dc=example, dc=it",
> $info);
>  
>     ldap_close ($ldap_conn);
> [...]
> ------
> I obtain tha following error message (in /var/log/httpd/error.log):
> ------
> LDAP: Object class violation
>         additional info: attribute not allowed
> ------
>Note that if I use only entries tagged with the comment on the right
>the add is done...

Because your not adding the objectclass entries except the last one, try:

$info ["objectClass"][0] = "person";
$info ["objectClass"][1] = "account";
$info ["objectClass"][2] = "posixAccount";
$info ["objectClass"][3] = "top";

Systems and Network Administrator
Morrison Industries
1825 Monroe Ave NW
Grand Rapids, MI. 49505