Fix LDAP DN concatenation, allow to define a search base
This commit is contained in:
parent
7a02d278ce
commit
9647c37516
|
@ -235,9 +235,10 @@ class Connection
|
|||
// We do not support pagination right now, and there is no chance to
|
||||
// do so for PHP < 5.4. Warnings about "Sizelimit exceeded" will
|
||||
// therefore not be hidden right now.
|
||||
$base = $query->hasBase() ? $query->getBase() : $this->root_dn;
|
||||
$results = @ldap_search(
|
||||
$this->ds,
|
||||
$this->root_dn,
|
||||
$base,
|
||||
(string) $query,
|
||||
$fields,
|
||||
0, // Attributes and values
|
||||
|
|
|
@ -90,6 +90,6 @@ class Node extends Root
|
|||
*/
|
||||
public function getDN()
|
||||
{
|
||||
return $this->parent->getDN() . '.' . $this->getRDN();
|
||||
return $this->getRDN() . ',' . $this->parent->getDN();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ class Query
|
|||
protected $limit_offset;
|
||||
protected $sort_columns = array();
|
||||
protected $count;
|
||||
protected $base;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -42,6 +43,22 @@ class Query
|
|||
$this->connection = $connection;
|
||||
}
|
||||
|
||||
public function setBase($base)
|
||||
{
|
||||
$this->base = $base;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function hasBase()
|
||||
{
|
||||
return $this->base !== null;
|
||||
}
|
||||
|
||||
public function getBase()
|
||||
{
|
||||
return $this->base;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count result set, ignoring limits
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue