Robert
Robert

Reputation: 778

LDAP PHP Centos

I am having strange things happen when using PHP LDAP

my username and password will authenticate correctly but if I just enter in an username with no password it also returns true. If I type my username with the wrong password it will fail properly. Below are the responses my code gets.

//Code Wrong Password
$login = ldap_bind( $ds, "Username", "WrongPass" ); 
var_dump($login);

//Response
Warning: ldap_bind(): Unable to bind to server: Invalid credentials in /var/www/sksinternal/httpdocs/LoginCredentials.php on line 36 bool(false) 


//Code correct Password
$login = ldap_bind( $ds, "Username", "CorrectPass" ); 
var_dump($login);

//Response
bool(true)


//Code No Password
$login = ldap_bind( $ds, "Username", "" ); 
var_dump($login);

//Response
bool(true) 

Centos 5 connecting to Windows 2008 server (Active Directory)

Upvotes: 0

Views: 439

Answers (1)

Terry Gardner
Terry Gardner

Reputation: 11132

There are three types of simple BIND:

  • anonymous
  • unauthenticated
  • authenticated

Use of the name with zero-length password is an unauthenticated BIND. The LDAP standards documents state that the name is to be used for 'tracing purposes' and cannot be used for authentication, therefore, no authentication has taken place.

Modern, professional-quality servers have an option to reject unauthenticated simple BIND requests because no authentication takes place. This may not be the case with your server.

Upvotes: 2

Related Questions