|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-01-24 17:02 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 16:00:01 2025 UTC |
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/" );