Patch to properly support LDAP SASL binds
| Bug #30819 | Patch to properly support LDAP SASL binds | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2004-11-18 00:16 UTC | Modified: | 2005-09-06 18:09 UTC |
|
||||||||||
| From: | quanah at stanford dot edu | Assigned: | ||||||||||||
| Status: | Closed | Package: | LDAP related | |||||||||||
| PHP Version: | 5CVS-2005-02-21 | OS: | * | |||||||||||
| Private report: | No | CVE-ID: | None | |||||||||||
[2004-11-18 00:16 UTC] quanah at stanford dot edu
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)(mail=$WEBAUTH_USER@*))"; $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.
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2004-11-18 00:50 UTC] dhawes at vt dot edu
[2005-04-17 18:26 UTC] sniper@php.net
[2005-04-26 23:22 UTC] quanah at stanford dot edu