#21866 [NEW]: Secure LDAP bind fails

From: Date: Fri, 24 Jan 2003 19:21:33 +0000
Subject: #21866 [NEW]: Secure LDAP bind fails
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-31174@lists.php.net to get a copy of this message
From: fehr@markus.ch Operating system: Win2000 PHP version: 4CVS-2003-01-24 (stable) PHP Bug Type: LDAP related Bug description: Secure LDAP bind fails 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 bug report at http://bugs.php.net/?id=21866&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=21866&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=21866&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=21866&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=21866&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=21866&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=21866&r=support Expected behavior: http://bugs.php.net/fix.php?id=21866&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=21866&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=21866&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=21866&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21866&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=21866&r=dst IIS Stability: http://bugs.php.net/fix.php?id=21866&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=21866&r=gnused

« previous php.bugs (#31174) next »