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

ldap_add - Error number 65: Object class violation

Hi All.

This was initially submitted to the PHP list, but I have received no reply which would lead me to believe this might be better suited for the LDAP list. Hence...

Our ISP has a web page that allows ISP customers to add sub-email accounts to their existing accounts. The information is stored on an LDAP server and added via the ldap_add command.

Currently I am getting the following error when trying to add a sub account.

Warning: LDAP: add operation could not be completed. in /usr/web/pmt.coop/htdocs/userTools/email/doAddCheckEmail.php on line 63
An error occurred. Error number 65: Object class violation

The following is a list of the object classes and attributes as they appear in the script.

// prepare data
$info["uid"]= $addEmail;
$info["cn"]= $sessCN;
$info["l"]= $sessL;
$info["givenname"] = $sessGivenname;
$info["mail"] = $addEmail . "@pmt.org";
$info["userpassword"] = "{CRYPT}".crypt($password);
$info["loginshell"] = "/bin/bash";
$info["homedirectory"] = "/home/" . $sessUsername . "/" . $addEm
$info["gidnumber"] = "101";
$info["uidnumber"] = "9514";
$info["uidnumber"] = "9514";
$info["gecos"] = "$sessCN";
$info["mailMessageStore"] ="/home/vmail/pmt/$addEmail/";
$info["ispParentAcct"] =$sessUsername;

                $info["objectclass"][0] = "person";
                $info["objectclass"][1] = "organizationalPerson";
                $info["objectclass"][2] = "inetOrgPerson";
                $info["objectclass"][3] = "posixAccount";
                $info["objectclass"][4] = "top";
                $info["objectclass"][5] = "shadowAccount";
                $info["objectclass"][6] = "qmailUser";
                $info["objectclass"][7] = "ispAccount";

The following is the line that is generating the error.

// add data to directory
$r=ldap_add($connection, $dn, $info);
if ($r) {
echo "Added LDAP data" ;
else {
echo "An error occurred. Error number " . ldap_errno($connection) . ":
" . ldap_err2str(ldap_errno($connection));

I am beating my head trying to figure this one out. I know it's an object class violation, but I can't figure out if it's one that is in place or one that I am missing. I thought that it may have been the ispAccount OC, but removing that and the ispParentAcct did not resolve the error.

I can add an ldif with all the parameters that are being generated by the page from the command line without problem.

I hope someone can help.

Bobby R. Cox
Linux Systems Administrator
Project Mutual Telephone
Fix the problem,  not the blame.   <><