From: ondra dot hosek at gmail dot com Operating system: PHP version: Irrelevant Package: LDAP related Bug Type: Feature/Change Request Bug description:[PATCH] add ldap_modify_batch function
Description: ------------ Hi, motivated by the impossibility of performing an Active Directory password change (not reset), which requires a simultaneous REMOVE and ADD operation on the unicodePwd attribute of a user, I have set out to write a function named ldap_modify_batch that would allow this. The test script demonstrates the API of this function. I'll admit that this API (especially the array-of-arrays-of-arrays part) is a bit weird and I'll gladly accept tips on how to streamline it. There is also a (more complete but also more contrived) example in the function body itself. Test script: --------------- <?php function adifyPw($pw) { $quoted = '"' . $pw . '"'; $utf16d = iconv("UTF-8", "UTF-16LE", $quoted); return $utf16d; } $curPwd = adifyPw("Tr0ub4dor&3"); $newPwd = adifyPw("correct horse battery staple"); $conn = ldap_connect("ldaps://dc.ad.example.com/"); ldap_bind($conn, "j...@ad.example.com", "Tr0ub4dor&3"); $mods = array( array( "attrib" => "unicodePwd", "modtype" => LDAP_MODIFY_BATCH_REMOVE, "values" => array($curPwd) ), array( "attrib" => "unicodePwd", "modtype" => LDAP_MODIFY_BATCH_ADD, "values" => array($newPwd) ) ); ldap_modify_batch($conn, "cn=John Smith,ou=Accounting,dc=ad,dc=example,dc=com", $mods); ldap_close($conn); ?> -- Edit bug report at https://bugs.php.net/bug.php?id=64317&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64317&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64317&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64317&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=64317&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=64317&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=64317&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=64317&r=needscript Try newer version: https://bugs.php.net/fix.php?id=64317&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=64317&r=support Expected behavior: https://bugs.php.net/fix.php?id=64317&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=64317&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=64317&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=64317&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64317&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=64317&r=dst IIS Stability: https://bugs.php.net/fix.php?id=64317&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=64317&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=64317&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=64317&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=64317&r=mysqlcfg