Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions apps/user_ldap/lib/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function __destruct() {
*/
public function __clone() {
$this->configuration = new Configuration($this->configPrefix,
!is_null($this->configID));
!is_null($this->configID));
if (count($this->bindResult) !== 0 && $this->bindResult['result'] === true) {
$this->bindResult = [];
}
Expand Down Expand Up @@ -407,9 +407,8 @@ private function doSoftValidation() {
} else {
$uuidAttributes = Access::UUID_ATTRIBUTES;
array_unshift($uuidAttributes, 'auto');
if (!in_array($this->configuration->$effectiveSetting,
$uuidAttributes)
&& (!is_null($this->configID))) {
if (!in_array($this->configuration->$effectiveSetting, $uuidAttributes)
&& !is_null($this->configID)) {
$this->configuration->$effectiveSetting = 'auto';
$this->configuration->saveConfiguration();
$this->logger->info(
Expand Down Expand Up @@ -606,12 +605,18 @@ private function establishConnection() {
if (!$isBackupHost) {
throw $e;
}
$this->logger->warning(
'Main LDAP not reachable, connecting to backup',
[
'app' => 'user_ldap'
]
);
}

//if LDAP server is not reachable, try the Backup (Replica!) Server
if ($isBackupHost || $isOverrideMainServer) {
$this->doConnect($this->configuration->ldapBackupHost,
$this->configuration->ldapBackupPort);
$this->configuration->ldapBackupPort);

Check notice

Code scanning / Psalm

PossiblyNullArgument

Argument 2 of OCA\User_LDAP\Connection::doConnect cannot be null, possibly null value provided
$this->bindResult = [];
$bindStatus = $this->bind();
$error = $this->ldap->isResource($this->ldapConnectionRes) ?
Expand Down Expand Up @@ -681,8 +686,8 @@ public function bind() {
}

$ldapLogin = @$this->ldap->bind($cr,
$this->configuration->ldapAgentName,
$this->configuration->ldapAgentPassword);
$this->configuration->ldapAgentName,

Check notice

Code scanning / Psalm

PossiblyNullArgument

Argument 2 of OCA\User_LDAP\ILDAPWrapper::bind cannot be null, possibly null value provided
$this->configuration->ldapAgentPassword);

Check notice

Code scanning / Psalm

PossiblyNullArgument

Argument 3 of OCA\User_LDAP\ILDAPWrapper::bind cannot be null, possibly null value provided

$this->bindResult = [
'sum' => md5($this->configuration->ldapAgentName . $this->configPrefix . $this->configuration->ldapAgentPassword),
Expand Down