$ds = ldap_connect($hostname);
if ($ds) {
$ldapbind = ldap_bind($ds,$dn,$pass);
if($ldapbind) {
if ($ds) {
$ldapbind = ldap_bind($ds,$dn,$pass);
if($ldapbind) {
/* The new Part */
$info["objectclass"][0] = "top";
/* ... */
$info["objectclass"][0] = "top";
/* ... */
$info["objectclass"][6] = "otherlist";
/* What you need to inster in PERL */
$info["cn"] = $cn;
$info["uid"] = $uid;
/* ... */
$info["cn"] = $cn;
$info["uid"] = $uid;
/* ... */
$r=ldap_add($ds, "uid=$uname".$rest, $info);
ldap_close($ds);
if($r) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
ldap_close($ds);
if($r) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
in Perl the red part is not needed, it's generated by itself, will thank good PHP didn't ask for the creatoesname and modifiresname and the timestamp, what I know in PHP if you send an empty field, or your add array didn't mention it, it would be inserted as if you sent a null string, but as I'm not an expert in LDAP, I don't know what the objectclass even refers to, so I guess these things are required, and I suppose PERL just generates them for you if they don't exist, but PHP just requires them to exist.
I really don't know.
On 9/15/05, Yaman Saqqa <[EMAIL PROTECTED]> wrote:
Do you mind showing the list a sample proof of concept of your code, however trivial, the point is to share knowledge.
Try to show both pieces, the one missing the objectClasses, and the one containing them in the array. This demonstrates how 2 hours can be spent on something really tricky.
btw, My understanding of the way Perl deals with this, is that the objecClass is no different for Net::LDAP than any other attribute spcified in your Net::LDAP::Entry object passed to the add method. Even if you send and empty object it will be inserted 'as is' in your directory. Can we say that the php of doingit is more smart in the way it actually checks for the spcification of an object class. I'm just trying to throw some ideas here.
Thanks Ala'.
On 9/15/05, Ala'a Ibrahim <[EMAIL PROTECTED] > wrote:I found it (it was some kind of miracle to discover it after more than 2 hours of trying everything).When you use Perl to add an entry to the LDAP you don't even care about the objectclass entrys the LDAP just adds them for you (or perhaps something else), but when it comes to PHP you have to add them to your add array (So stupid).Anyway thanks for taking care,By the way I would be sure next time not to post the link as is, thanks Yaman.
On 9/15/05, Yaman Saqqa <[EMAIL PROTECTED] > wrote:May be in such cases you wanna post the code! And make sure the link does not point back to where it's coming from (maktoob).
On 9/15/05, Ala'a Ibrahim < [EMAIL PROTECTED] > wrote:Dear All,I'm writing a script, in PHP 5 that adds an entry to the ldap, I keep getting this error, (and no entry is inserted)Warning: ldap_add() Add: Object class violation in ...The code is good to be in a manual. does anybody know what could cause this.Please it's urgent, I've googled with no results.
_______________________________________________
General mailing list
[email protected]
http://mail.jolug.org/mailman/listinfo/general_jolug.org
--
abulyomon
www.KiLLTHeUPLiNK.com
_______________________________________________
General mailing list
[email protected]
http://mail.jolug.org/mailman/listinfo/general_jolug.org
--
Ala'a A. Ibrahim
http://360.yahoo.com/bai_83
_______________________________________________
General mailing list
[email protected]
http://mail.jolug.org/mailman/listinfo/general_jolug.org
--
abulyomon
www.KiLLTHeUPLiNK.com
_______________________________________________
General mailing list
[email protected]
http://mail.jolug.org/mailman/listinfo/general_jolug.org
--
Ala'a A. Ibrahim
http://360.yahoo.com/bai_83
_______________________________________________ General mailing list [email protected] http://mail.jolug.org/mailman/listinfo/general_jolug.org
