ID:               30819
 Updated by:       [EMAIL PROTECTED]
 Reported By:      quanah at stanford dot edu
-Status:           Feedback
+Status:           Closed
 Bug Type:         LDAP related
 Operating System: *
 PHP Version:      5CVS-2005-02-21
 New Comment:

My patch is now committed to CVS.



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

[2005-04-11 01:52:27] [EMAIL PROTECTED]

Please try this modified patch:
 
  http://www.php.net/~jani/patches/bug30819.patch

I added some convenience constants and made all the 
parameters optional (except for the 1st one).

I tried it with your script here but it didn't work for me.


------------------------------------------------------------------------

[2004-11-18 00:50:52] dhawes at vt dot edu

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.

------------------------------------------------------------------------

[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