aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/dkim_signing.lua
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2017-06-10 15:45:29 +0200
committerAndrew Lewis <nerf@judo.za.org>2017-06-10 15:45:29 +0200
commitc30cfcb21a5d1b2fa14944ff3633198a95ea3c2d (patch)
treea947837bbd92ed3bdf4a22b54dd6b492e9500246 /src/plugins/lua/dkim_signing.lua
parentcd0cc6187ed4b153e3506bbf79d28aa760a85f4a (diff)
downloadrspamd-c30cfcb21a5d1b2fa14944ff3633198a95ea3c2d.tar.gz
rspamd-c30cfcb21a5d1b2fa14944ff3633198a95ea3c2d.zip
[Feature] Bayes expiry plugin
Diffstat (limited to 'src/plugins/lua/dkim_signing.lua')
-rw-r--r--src/plugins/lua/dkim_signing.lua15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/plugins/lua/dkim_signing.lua b/src/plugins/lua/dkim_signing.lua
index 78505bf92..edb4db2f6 100644
--- a/src/plugins/lua/dkim_signing.lua
+++ b/src/plugins/lua/dkim_signing.lua
@@ -15,6 +15,7 @@ See the License for the specific language governing permissions and
limitations under the License.
]]--
+local lutil = require "lua_util"
local rspamd_logger = require "rspamd_logger"
local dkim_sign_tools = require "dkim_sign_tools"
@@ -46,18 +47,6 @@ local N = 'dkim_signing'
local redis_params
local sign_func = rspamd_plugins.dkim.sign
-local function simple_template(tmpl, keys)
- local lpeg = require "lpeg"
-
- local var_lit = lpeg.P { lpeg.R("az") + lpeg.R("AZ") + lpeg.R("09") + "_" }
- local var = lpeg.P { (lpeg.P("$") / "") * ((var_lit^1) / keys) }
- local var_braced = lpeg.P { (lpeg.P("${") / "") * ((var_lit^1) / keys) * (lpeg.P("}") / "") }
-
- local template_grammar = lpeg.Cs((var + var_braced + 1)^0)
-
- return lpeg.match(template_grammar, tmpl)
-end
-
local function dkim_signing_cb(task)
local ret,p = dkim_sign_tools.prepare_dkim_signing(N, task, settings)
@@ -123,7 +112,7 @@ local function dkim_signing_cb(task)
end
else
if (p.key and p.selector) then
- p.key = simple_template(p.key, {domain = p.domain, selector = p.selector})
+ p.key = lutil.template(p.key, {domain = p.domain, selector = p.selector})
local sret, _ = sign_func(task, p)
return sret
else