From: alexis dot robert at gmail dot com Operating system: All PHP version: 5.2.6 PHP Bug Type: LDAP related Bug description: ldap.so fails to remove attributes when masked by the LDAP server
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 bug report at http://bugs.php.net/?id=45477&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45477&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45477&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45477&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45477&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45477&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45477&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45477&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45477&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45477&r=support Expected behavior: http://bugs.php.net/fix.php?id=45477&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45477&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45477&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45477&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45477&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45477&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45477&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45477&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45477&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45477&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45477&r=mysqlcfg