#19520 [Bgs]: ldap bind true

From: Date: Fri, 20 Sep 2002 23:20:12 +0000
Subject: #19520 [Bgs]: ldap bind true
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-19915@lists.php.net to get a copy of this message
ID: 19520 User updated by: fmj@natas.ch Reported By: fmj@natas.ch Status: Bogus Bug Type: LDAP related Operating System: Windows NT PHP Version: 4.2.2 New Comment: i think you are right. i'm not a ldap freak but developer should be careful, it could be a security hole if you only check the return value (true or false). Previous Comments: ------------------------------------------------------------------------ [2002-09-20 14:04:24] venaas@php.net Yes, especially if $user_dn is non-empty. PHP returns true only if the LDAP API's ldap_bind_s() function returns LDAP_SUCCESS. I'm pretty sure that the API function behaves the same, so this might be a problem with the LDAP API implementation. Are you sure that $user_dn is non-empty? I'm marking this as bogus since I'm pretty sure it's not a problem in PHP. ------------------------------------------------------------------------ [2002-09-20 04:21:58] fmj@natas.ch $user_ldappassword = ""; # connect to ldap echo "<br>trying to connect to ldap..."; $ldap = ldap_connect($ldap_host); if(!$ldap) echo "<br>Can't etablish connection to ".$ldap_host; else echo "<br>Connection etablished to ".$ldap_host; # get dn (if you don't know) $bind_dn = ldap_bind($ldap); // anonymous $search_dn = ldap_search($ldap,"o=awp","uid=".$user_ldapid); $result_dn = ldap_get_entries($ldap,$search_dn); for($i=0; $i < $result_dn['count']; $i++) $user_dn = $result_dn[$i]['dn']; echo "<br>dn: ".$user_dn; # get authed $auth_bind = ldap_bind($ldap,$user_dn,$user_ldappassword); if($auth_bind) echo "<br>You are in!"; else echo "<br>You are out!"; # close connection to ldap ldap_close($ldap); _______________________________________________________ try to get non-anonymous bind with userpassword = "" (empty string), the bind returns 1 and no error! (like this: LDAP: Unable to bind to server: Inappropriate authentication in ...) that's odd, isn't it? ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19520&edit=1

« previous php.bugs (#19915) next »