ID: 45477
User updated by: alexis dot robert at gmail dot com
Reported By: alexis dot robert at gmail dot com
-Status: Feedback
+Status: Open
Bug Type: LDAP related
Operating System: *
PHP Version: 5.2.6
New Comment:
It says :
REMOVE :
Warning: ldap_mod_del() [function.ldap-mod-del]: Modify: Server is
unwilling to perform in C:\wamp\www\bug.php on line 11
Previous Comments:
------------------------------------------------------------------------
[2008-07-11 15:01:04] [EMAIL PROTECTED]
Have you tried this:
ldap_mod_del($cnx,$dn,array('userPassword' => array()));
------------------------------------------------------------------------
[2008-07-10 14:14:11] 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:
--------------
[EMAIL PROTECTED]:~$ php bug.php
REMOVE :
Warning: ldap_mod_del(): Unknown attribute in the data in
/home/alexis/bug.php on line 11
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45477&edit=1