From ea744e5dfdce60bceaab3be5bb71003eed6e687f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Weigert?= Date: Tue, 18 Jul 2023 15:05:54 +0200 Subject: [PATCH 1/3] guessBaseDN should also try to parse domain part from a user given in email syntax Suggested fix for #797 --- lib/Wizard.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/Wizard.php b/lib/Wizard.php index b506de21..518b4c5f 100644 --- a/lib/Wizard.php +++ b/lib/Wizard.php @@ -685,6 +685,17 @@ public function guessBaseDN() { } } + //check whether the agent name is in email form + $i = \stripos($this->configuration->ldapAgentName, '@'); + if ($i !== false) { + $base1 = \substr($this->configuration->ldapAgentName, $i+1); + $base1 = 'dc=' . \implode(',dc=', \explode('.', $base1)); + if ($this->testBaseDN($base)) { + $this->applyFind('ldap_base', $base); + return $this->result; + } + } + //this did not help :( //Let's see whether we can parse the Host URL and convert the domain to //a base DN From e5246d4adb8ad17b415c6a6521dfa5672ac5afc5 Mon Sep 17 00:00:00 2001 From: Juergen Weigert Date: Mon, 24 Jul 2023 13:10:52 +0200 Subject: [PATCH 2/3] Yes, thanks @jvillafanez for spotting these mistakes. --- lib/Wizard.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Wizard.php b/lib/Wizard.php index 518b4c5f..fb2f122d 100644 --- a/lib/Wizard.php +++ b/lib/Wizard.php @@ -685,13 +685,13 @@ public function guessBaseDN() { } } - //check whether the agent name is in email form - $i = \stripos($this->configuration->ldapAgentName, '@'); + //check whether the agent name is in email form; last '@' is taken, if muptiple. + $i = \strrpos($this->configuration->ldapAgentName, '@'); if ($i !== false) { $base1 = \substr($this->configuration->ldapAgentName, $i+1); $base1 = 'dc=' . \implode(',dc=', \explode('.', $base1)); - if ($this->testBaseDN($base)) { - $this->applyFind('ldap_base', $base); + if ($this->testBaseDN($base1)) { + $this->applyFind('ldap_base', $base1); return $this->result; } } From 890df9eb55ca69353fc9eca010e336bbcfda7843 Mon Sep 17 00:00:00 2001 From: Juergen Weigert Date: Thu, 27 Jul 2023 20:16:03 +0200 Subject: [PATCH 3/3] tiny typo --- lib/Wizard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Wizard.php b/lib/Wizard.php index fb2f122d..fa7f2cdd 100644 --- a/lib/Wizard.php +++ b/lib/Wizard.php @@ -685,7 +685,7 @@ public function guessBaseDN() { } } - //check whether the agent name is in email form; last '@' is taken, if muptiple. + //check whether the agent name is in email form; last '@' is taken, if multiple. $i = \strrpos($this->configuration->ldapAgentName, '@'); if ($i !== false) { $base1 = \substr($this->configuration->ldapAgentName, $i+1);