|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-07-10 14:14 UTC] alexis dot robert at gmail dot com
Description:
------------
Hi,
I currently work at Hachette-Livre (in Paris, France), and I rewrite their authentification system. Their previous version didn't use php_ldap to change password because it was said that the developer had given up saying that it's impossible to do it with PHP (they used a handwritten Java software called by PHP to change their password).
The fact is, that it's really impossible ! (or I'm really bad) In fact, NDS (Novell Directory Server) masks the userPassword attribute if I query it, but the doc says that users can delete/add it.
So, because this field doesn't appear in the LDAP query, ldap_mod_delete fails, saying "Unknown attribute in the data", which is pretty logic.
If I read the sourcecode, this issue doesn't seem to come from libldap, but in the PHP module (approx. line 1428). I've tried to do a patch but I'm not very keen on everything around LDAP (this is hmm the second time I cross LDAP on my way -- btw I'm 18, that explains :D ), and I don't know if it works (and so I have a server problem *with* a PHP problem) or not.
I think that the main part is guessing ldap_mods[i]->mod_type from the attribute name if we delete an attribute, but I've said that I'm not very an LDAP expert.
If you want any further informations, don't mind asking me :)
Reproduce code:
---------------
<?php
$cnx = ldap_connect("ldap://ldap.example.org");
$dn = "cn=user,ou=paris,o=example";
$pass = "php-developers-eat-kitties-and-bears";
ldap_bind($cnx,$dn,$pass);
print "REMOVE : ";
if (ldap_mod_del($cnx,$dn,array("userPassword"))) {
print "ADD : ";
ldap_mod_add($cnx, $dn, array("userPassword" => "php-developers-dont-eat-kitties-and-bears"));
}
?>
Expected result:
----------------
My coffee and no more "Unknown attribute in the data" (or other annoying errors which make you want to hit your computer).
Actual result:
--------------
alexis@ubuntu:~$ php bug.php
REMOVE :
Warning: ldap_mod_del(): Unknown attribute in the data in /home/alexis/bug.php on line 11
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 17:00:02 2025 UTC |
Have you tried this: ldap_mod_del($cnx,$dn,array('userPassword' => array()));