ID:               21866
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Bogus
 Bug Type:         LDAP related
 Operating System: Win2000
 PHP Version:      4CVS-2003-01-24 (stable)
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

LDAP error, you may be able to fix it by upgrading to a later version
of ldap. The error you are seeing is given by the ldap library itself
and has nothing to do with PHP itself.


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

[2003-01-24 13:21:33] [EMAIL PROTECTED]

There seems to be a bug to connect SECURE to an LDAP server.

The following script is working fine if I connect using the ldap://
protocol. However, connecting to the LDAP server through SSL (ldaps://)
the bind fails with the error "DSA is unwilling to perform (Error 53)"

The LDAP server is configured for SSL.

function checkerror( $ldap, $stepinfo )
{
    if (ldap_errno($ldap) != 0) { 
        $ldaperr = ldap_errno( $ldap );
        $ldapmsg = ldap_error( $ldap );
        print "<br><b>ERROR at $stepinfo: $ldapmsg
($ldaperr)</b></br>\n";
        return FALSE;
    }
    return TRUE;
}
    
function doit( $ldap_server )
{
    $basedn      = "dc=mydc,o=myorg";
    $searcharg   = "sn=F*";
    $ldap_rdn    = "uid=myname,cn=users,dc=mydc,o=myorg";
    $ldap_passwd = "mypassword";

    print "Connecting to ldap server <B>$ldap_server</B> at port
<B>$ldap_port</B><BR>\n";
    $ldap = ldap_connect( $ldap_server );

    if( checkerror( $ldap, "ldap_connect" ) == FALSE ) { return; }

    print "Binding to ldap server using rdn <B>$ldap_rdn</B><BR>\n";
    $bind = ldap_bind($ldap, $ldap_rdn, $ldap_passwd );
    
    if( checkerror( $ldap, "ldap_bind" ) == FALSE ) { return; }

    $mysuccess = ldap_search( $ldap, $basedn, $searcharg );

    if( checkerror( $ldap, "ldap_search" ) == FALSE ) { return; }

   $sr = $mysuccess;
   $ds = $ldap;

   echo "Number of entires returned is
<B>".ldap_count_entries($ds,$sr)."</B><p>\n"; 

   $info = ldap_get_entries($ds, $sr); 
   echo "Data for ".$info["count"]." items returned:<p>"; 

   for ($i=0; $i<$info["count"]; $i++) { 
       echo "dn is: ". $info[$i]["dn"] ."<br>\n"; 
       echo "first cn entry is: ". $info[$i]["cn"][0] ."<br>\n"; 
       echo "first email entry is: ". $info[$i]["mail"][0] ."<p>\n"; 
   } 

    ldap_close($ldap);
    return TRUE;
}

doit( "ldap://myserver/"; );
doit( "ldaps://myserver/" );


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


-- 
Edit this bug report at http://bugs.php.net/?id=21866&edit=1

Reply via email to