From: quanah at stanford dot edu Operating system: ALL PHP version: 5.0.2 PHP Bug Type: LDAP related Bug description: Patch to properly support LDAP SASL binds
Description: ------------ Hello, I've written a patch against PHP-5.0.2 that properly impelments LDAP SASL binds for all mechanisms. The current code in 5.0.2 does not support LDAP SASL binds at all, although the function exists. The patch can be found at: http://www.stanford.edu/services/directory/clients/examples/ldap-sasl It follows the PHP development guidelines. This patch has been tested with multiple SASL authentication mechanisms. Regards, Quanah Reproduce code: --------------- #!/usr/local/bin/php <?php $ldap = ldap_connect("ldap.stanford.edu"); if($ldap) { $r = ldap_bind($ldap); } else { echo "Unable to connect!"; } ldap_set_option($ldap,LDAP_OPT_PROTOCOL_VERSION,3); if (ldap_sasl_bind($ldap,"","","GSSAPI")) { $dn = "cn=people,dc=stanford,dc=edu"; $filter = "(|(susearchid=$WEBAUTH_USER)([EMAIL PROTECTED]))"; $result = ldap_search($ldap, $dn, $filter); if ($result) { echo "Number of entries returned is " . ldap_count_entries($ldap, $result) . "<br />"; print("\n"); $info = ldap_get_entries($ldap,$result); echo "Data for " . $info["count"] . " items returned:<p>"; print("\n"); for($i=0;$i<$info["count"];$i++) { echo "dn is: " . $info[$i]["dn"] . "<br />"; print("\n"); echo "first cn entry is: " . $info[$i]["cn"][0] . "<br />"; print("\n"); echo "first email is: " . $info[$i]["mail"][0] . "<br /> <hr />"; print("\n"); } } ldap_close($ldap); } ?> Expected result: ---------------- I'd expect this to work in PHP Actual result: -------------- Doesn't work at all without my patch. Works correctly with my patch. -- Edit bug report at http://bugs.php.net/?id=30819&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30819&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30819&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30819&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30819&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30819&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30819&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30819&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30819&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30819&r=support Expected behavior: http://bugs.php.net/fix.php?id=30819&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30819&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30819&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30819&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30819&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30819&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30819&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30819&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30819&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30819&r=mysqlcfg
