summaryrefslogtreecommitdiffstats
path: root/lualib/lua_auth_results.lua
diff options
context:
space:
mode:
authorbjoe2k4 <bjoe2k4@users.noreply.github.com>2018-04-16 22:41:22 +0200
committerGitHub <noreply@github.com>2018-04-16 22:41:22 +0200
commit4d6c328fecf0d533419de88a9b3a7ec70828ec9b (patch)
tree68c5a18230fb7649461461a8dcdcd4e101fbf90a /lualib/lua_auth_results.lua
parent4b484e29fa420bc65a85c87b0dd8df432ffecef7 (diff)
downloadrspamd-4d6c328fecf0d533419de88a9b3a7ec70828ec9b.tar.gz
rspamd-4d6c328fecf0d533419de88a9b3a7ec70828ec9b.zip
[Minor] Simplify auth=pass generation of AR/AAR header
Diffstat (limited to 'lualib/lua_auth_results.lua')
-rw-r--r--lualib/lua_auth_results.lua25
1 files changed, 8 insertions, 17 deletions
diff --git a/lualib/lua_auth_results.lua b/lualib/lua_auth_results.lua
index e8808d842..1636472c6 100644
--- a/lualib/lua_auth_results.lua
+++ b/lualib/lua_auth_results.lua
@@ -171,25 +171,16 @@ local function gen_auth_results(task, settings)
local smtp_from = task:get_from('smtp')
if u and smtp_from then
- local hdr
-
- if #smtp_from[1]['addr'] > 0 then
- if settings['add_smtp_user'] then
- hdr = string.format('auth=pass smtp.auth=%s smtp.mailfrom=%s',
- u, smtp_from[1]['addr'])
- else
- hdr = string.format('auth=pass smtp.mailfrom=%s',
- smtp_from[1]['addr'])
- end
- else
- if settings['add_smtp_user'] then
- hdr = string.format('auth=pass smtp.auth=%s', u)
- else
- hdr = 'auth=pass'
- end
+ local hdr = {[1] = 'auth=pass'}
+
+ if settings['add_smtp_user'] then
+ table.insert(hdr,'smtp.auth=' .. u)
+ end
+ if smtp_from[1]['addr'] then
+ table.insert(hdr,'smtp.mailfrom=' .. smtp_from[1]['addr'])
end
- table.insert(hdr_parts, hdr)
+ table.insert(hdr_parts, table.concat(hdr,' ')
end
if #hdr_parts > 0 then