Skip to content
Permalink
Browse files Browse the repository at this point in the history
Stricter parameter check.
  • Loading branch information
yunosh committed Jun 3, 2014
1 parent 5410fbb commit 4c3e18f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions framework/Ldap/lib/Horde/Ldap.php
Expand Up @@ -206,10 +206,10 @@ protected function setConfig($config)
public function bind($dn = null, $password = null)
{
/* Fetch current bind credentials. */
if (empty($dn)) {
if (is_null($dn)) {
$dn = $this->_config['binddn'];
}
if (empty($password)) {
if (is_null($password)) {
$password = $this->_config['bindpw'];
}

Expand Down
13 changes: 13 additions & 0 deletions framework/Ldap/test/Horde/Ldap/LdapTest.php
Expand Up @@ -83,6 +83,19 @@ public function testConnectAndAnonymousBind()
$ldap = new Horde_Ldap($lcfg);
}

/**
* Tests if the server can connect and bind, but not rebind with empty
* password.
*
* @expectedException Horde_Ldap_Exception
*/
public function testConnectAndEmptyRebind()
{
// Simple working connect and privileged bind.
$ldap = new Horde_Ldap(self::$ldapcfg['server']);
$ldap->bind(self::$ldapcfg['server']['binddn'], '');
}

/**
* Tests startTLS() if server supports it.
*/
Expand Down

0 comments on commit 4c3e18f

Please sign in to comment.