ID:               30819
 Comment by:       dhawes at vt dot edu
 Reported By:      quanah at stanford dot edu
 Status:           Open
 Bug Type:         LDAP related
 Operating System: ALL
 PHP Version:      5.0.2
 New Comment:

I attempted to get a similar patch submitted last May, but discussion
came to a standstill.  Quanah and I have tested this with GSSAPI,
EXTERNAL, and (I believe) DIGEST-MD5.  I would like to see this patch
included in PHP so I can stop requiring users to patch their source.


Previous Comments:
------------------------------------------------------------------------

[2004-11-18 00:16:46] 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)([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 this bug report at http://bugs.php.net/?id=30819&edit=1

Reply via email to