mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-24 22:34:24 +02:00
Ldap\Connection: Re-organize some properties
lowerCamelCase, initialisation in __construct, and stuff.. refs #8954
This commit is contained in:
parent
9b0ac3000a
commit
b25bf4838b
@ -89,18 +89,18 @@ class Connection implements Selectable
|
|||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $hostname;
|
protected $hostname;
|
||||||
protected $port = 389;
|
protected $port;
|
||||||
protected $bind_dn;
|
protected $bindDn;
|
||||||
protected $bind_pw;
|
protected $bindPw;
|
||||||
protected $root_dn;
|
protected $rootDn;
|
||||||
protected $reqCert = true;
|
protected $validateCertificate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the bind on this connection has already been performed
|
* Whether the bind on this connection has already been performed
|
||||||
*
|
*
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
protected $bound = false;
|
protected $bound;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current connection's root node
|
* The current connection's root node
|
||||||
@ -121,7 +121,7 @@ class Connection implements Selectable
|
|||||||
*
|
*
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
protected $discoverySuccess = false;
|
protected $discoverySuccess;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new connection object
|
* Create a new connection object
|
||||||
@ -131,15 +131,16 @@ class Connection implements Selectable
|
|||||||
public function __construct(ConfigObject $config)
|
public function __construct(ConfigObject $config)
|
||||||
{
|
{
|
||||||
$this->hostname = $config->hostname;
|
$this->hostname = $config->hostname;
|
||||||
$this->bind_dn = $config->bind_dn;
|
$this->bindDn = $config->bind_dn;
|
||||||
$this->bind_pw = $config->bind_pw;
|
$this->bindPw = $config->bind_pw;
|
||||||
$this->root_dn = $config->root_dn;
|
$this->rootDn = $config->root_dn;
|
||||||
$this->port = $config->get('port', $this->port);
|
$this->port = $config->get('port', 389);
|
||||||
$this->encryption = $config->get('encryption');
|
$this->validateCertificate = (bool) $config->get('reqcert', true);
|
||||||
|
|
||||||
|
$this->encryption = $config->encryption;
|
||||||
if ($this->encryption !== null) {
|
if ($this->encryption !== null) {
|
||||||
$this->encryption = strtolower($this->encryption);
|
$this->encryption = strtolower($this->encryption);
|
||||||
}
|
}
|
||||||
$this->reqCert = (bool) $config->get('reqcert', $this->reqCert);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -169,7 +170,7 @@ class Connection implements Selectable
|
|||||||
*/
|
*/
|
||||||
public function getDn()
|
public function getDn()
|
||||||
{
|
{
|
||||||
return $this->root_dn;
|
return $this->rootDn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -445,7 +446,7 @@ class Connection implements Selectable
|
|||||||
|
|
||||||
$results = @ldap_search(
|
$results = @ldap_search(
|
||||||
$this->ds,
|
$this->ds,
|
||||||
$query->getBase() ?: $this->root_dn,
|
$query->getBase() ?: $this->rootDn,
|
||||||
(string) $query,
|
(string) $query,
|
||||||
array_values($fields),
|
array_values($fields),
|
||||||
0, // Attributes and values
|
0, // Attributes and values
|
||||||
@ -459,7 +460,7 @@ class Connection implements Selectable
|
|||||||
throw new LdapException(
|
throw new LdapException(
|
||||||
'LDAP query "%s" (base %s) failed. Error: %s',
|
'LDAP query "%s" (base %s) failed. Error: %s',
|
||||||
$query,
|
$query,
|
||||||
$query->getBase() ?: $this->root_dn,
|
$query->getBase() ?: $this->rootDn,
|
||||||
ldap_error($this->ds)
|
ldap_error($this->ds)
|
||||||
);
|
);
|
||||||
} elseif (ldap_count_entries($this->ds, $results) === 0) {
|
} elseif (ldap_count_entries($this->ds, $results) === 0) {
|
||||||
@ -524,7 +525,7 @@ class Connection implements Selectable
|
|||||||
$limit = $query->getLimit();
|
$limit = $query->getLimit();
|
||||||
$offset = $query->hasOffset() ? $query->getOffset() - 1 : 0;
|
$offset = $query->hasOffset() ? $query->getOffset() - 1 : 0;
|
||||||
$queryString = (string) $query;
|
$queryString = (string) $query;
|
||||||
$base = $query->getBase() ?: $this->root_dn;
|
$base = $query->getBase() ?: $this->rootDn;
|
||||||
|
|
||||||
if (empty($fields)) {
|
if (empty($fields)) {
|
||||||
$fields = $query->getColumns();
|
$fields = $query->getColumns();
|
||||||
@ -820,7 +821,7 @@ class Connection implements Selectable
|
|||||||
if (Platform::isWindows()) {
|
if (Platform::isWindows()) {
|
||||||
putenv('LDAPTLS_REQCERT=never');
|
putenv('LDAPTLS_REQCERT=never');
|
||||||
} else {
|
} else {
|
||||||
if ($this->reqCert) {
|
if ($this->validateCertificate) {
|
||||||
$ldap_conf = $this->getConfigDir('ldap_ca.conf');
|
$ldap_conf = $this->getConfigDir('ldap_ca.conf');
|
||||||
} else {
|
} else {
|
||||||
$ldap_conf = $this->getConfigDir('ldap_nocert.conf');
|
$ldap_conf = $this->getConfigDir('ldap_nocert.conf');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user