public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Commit
[Dovecot] Fix EAS login and improve logging
c4d0f350
data/conf/dovecot/auth/mailcowauth.php | 2 +-
data/conf/dovecot/auth/passwd-verify.lua | 11 +++++++++--
2 files changed, 10 insertions(+), 3 deletions(-)
Diff
diff --git a/data/conf/dovecot/auth/mailcowauth.php b/data/conf/dovecot/auth/mailcowauth.php
index 4eda382b..c625522b 100644
--- a/data/conf/dovecot/auth/mailcowauth.php
+++ b/data/conf/dovecot/auth/mailcowauth.php
@@ -80,7 +80,7 @@ if ($isSOGoRequest) {
}
if ($result === false){
// If it's a SOGo Request, don't check for protocol access
- $service = (isSOGoRequest) ? false : array($post['service'] => true);
+ $service = ($isSOGoRequest) ? false : array($post['service'] => true);
$result = apppass_login($post['username'], $post['password'], $service, array(
'is_internal' => true,
'remote_addr' => $post['real_rip']
diff --git a/data/conf/dovecot/auth/passwd-verify.lua b/data/conf/dovecot/auth/passwd-verify.lua
index 19dcc4bd..b8843c99 100644
--- a/data/conf/dovecot/auth/passwd-verify.lua
+++ b/data/conf/dovecot/auth/passwd-verify.lua
@@ -34,8 +34,15 @@ function auth_password_verify(request, password)
return dovecot.auth.PASSDB_RESULT_INTERNAL_FAILURE, "Upstream error"
end
- local api_response = json.decode(table.concat(res))
- if api_response.success == true then
+ local response_str = table.concat(res)
+ local is_response_valid, response_json = pcall(json.decode, response_str)
+
+ if not is_response_valid then
+ dovecot.i_info("Invalid JSON received: " .. response_str)
+ return dovecot.auth.PASSDB_RESULT_INTERNAL_FAILURE, "Invalid response format"
+ end
+
+ if response_json.success == true then
return dovecot.auth.PASSDB_RESULT_OK, ""
end