mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-10 07:24:25 +02:00
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
|
// We do not support pagination right now, and there is no chance to
|
||||||
// do so for PHP < 5.4. Warnings about "Sizelimit exceeded" will
|
// do so for PHP < 5.4. Warnings about "Sizelimit exceeded" will
|
||||||
// therefore not be hidden right now.
|
// therefore not be hidden right now.
|
||||||
|
$base = $query->hasBase() ? $query->getBase() : $this->root_dn;
|
||||||
$results = @ldap_search(
|
$results = @ldap_search(
|
||||||
$this->ds,
|
$this->ds,
|
||||||
$this->root_dn,
|
$base,
|
||||||
(string) $query,
|
(string) $query,
|
||||||
$fields,
|
$fields,
|
||||||
0, // Attributes and values
|
0, // Attributes and values
|
||||||
|
@ -90,6 +90,6 @@ class Node extends Root
|
|||||||
*/
|
*/
|
||||||
public function getDN()
|
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 $limit_offset;
|
||||||
protected $sort_columns = array();
|
protected $sort_columns = array();
|
||||||
protected $count;
|
protected $count;
|
||||||
|
protected $base;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -42,6 +43,22 @@ class Query
|
|||||||
$this->connection = $connection;
|
$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
|
* Count result set, ignoring limits
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user