[PHP] ldap_add - Error number 65: Object class violation
Hi All. 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 ail; $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 hope someone can help. I apologize if this is better directed to the openldap list. TIA Bobby R. Cox Linux Systems Administrator Project Mutual Telephone [EMAIL PROTECTED] 208.434.7185 Fix the problem, not the blame. <>< -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] explode() an array and grep out a string
Hi all. Is it possible to explode an array and have it exclude a certain string. I currently have an array that is an ldapsearch that returns sub-accounts of a parent account. These accounts are then displayed so customer can either change the passwd or delete them.Thing is ldapsearch returns everymatch which includes the parent account, which is already listed on the page as the parent account. I would like to eliminate the second listing of the parent account where the sub-accounts are listed. This is where the array is collected: $search = ldap_search($connection,"dc=isp,dc=com", "ispParentAcct=$sessUsername"); $entries = ldap_get_entries($connection, $search); $num = $entries["count"]; if ($num) { $sessSubAccounts = ""; $i = 0; while ($i < $num) { $sessSubAccounts .= $entries[$i]["uid"][0] . "|"; $i++; } } One thing I would like to point out is that I did not have this problem before, but when I updated to a new version of openldap the following ldapsearch would no longer return the subaccounts: $search = ldap_search($connection,"dc=isp,dc=com", "homeDirectory=/home/$sessUsername/*"); Any idea why that may be? This is where the array is exploded: if ($sessSubAccounts) { $accounts = explode("|", $sessSubAccounts); while ($i < count($accounts) - 1) ?> TIA Bobby R. Cox Linux Systems Administrator Project Mutual Telephone [EMAIL PROTECTED] 208.434.7185 Fix the problem, not the blame. <>< -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php