php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21866 Secure LDAP bind fails
Submitted: 2003-01-24 13:21 UTC Modified: 2003-01-24 17:02 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: fehr at markus dot ch Assigned:
Status: Not a bug Package: LDAP related
PHP Version: 4CVS-2003-01-24 (stable) OS: Win2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: fehr at markus dot ch
New email:
PHP Version: OS:

 

 [2003-01-24 13:21 UTC] fehr at markus dot ch
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/" );

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-24 17:02 UTC] iliaa@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 23 06:01:35 2024 UTC