Skip to content

Commit 47a34c0

Browse files
authored
Merge pull request #32284 from nextcloud/backport/32246/stable23
[stable23] Don't use hash to check if binding worked
2 parents b5f7ef0 + 22831d2 commit 47a34c0

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

apps/user_ldap/lib/Connection.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class Connection extends LDAPUtility {
125125
protected $ignoreValidation = false;
126126

127127
/**
128-
* @var array{dn?: mixed, hash?: string, result?: bool}
128+
* @var array{sum?: string, result?: bool}
129129
*/
130130
protected $bindResult = [];
131131

@@ -669,11 +669,7 @@ public function bind() {
669669

670670
if (
671671
count($this->bindResult) !== 0
672-
&& $this->bindResult['dn'] === $this->configuration->ldapAgentName
673-
&& \OC::$server->getHasher()->verify(
674-
$this->configPrefix . $this->configuration->ldapAgentPassword,
675-
$this->bindResult['hash']
676-
)
672+
&& $this->bindResult['sum'] === md5($this->configuration->ldapAgentName . $this->configPrefix . $this->configuration->ldapAgentPassword)
677673
) {
678674
// don't attempt to bind again with the same data as before
679675
// bind might have been invoked via getConnectionResource(),
@@ -686,8 +682,7 @@ public function bind() {
686682
$this->configuration->ldapAgentPassword);
687683

688684
$this->bindResult = [
689-
'dn' => $this->configuration->ldapAgentName,
690-
'hash' => \OC::$server->getHasher()->hash($this->configPrefix . $this->configuration->ldapAgentPassword),
685+
'sum' => md5($this->configuration->ldapAgentName . $this->configPrefix . $this->configuration->ldapAgentPassword),
691686
'result' => $ldapLogin,
692687
];
693688

0 commit comments

Comments
 (0)