aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dkim_check.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-05-25 16:03:22 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-05-25 16:03:22 +0100
commit0dad88c186150ce803c4e198ef61bdd804dd5240 (patch)
tree05b56f0690ef14c35f55712f172bb3cbdbc580ef /src/plugins/dkim_check.c
parent81642a03f5f56da26fdd597cfca11715ff5b828f (diff)
downloadrspamd-0dad88c186150ce803c4e198ef61bdd804dd5240.tar.gz
rspamd-0dad88c186150ce803c4e198ef61bdd804dd5240.zip
[Minor] Allow to specify dkim header type on check
Diffstat (limited to 'src/plugins/dkim_check.c')
-rw-r--r--src/plugins/dkim_check.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/plugins/dkim_check.c b/src/plugins/dkim_check.c
index 8cb5cb611..475b40c7e 100644
--- a/src/plugins/dkim_check.c
+++ b/src/plugins/dkim_check.c
@@ -1443,12 +1443,35 @@ lua_dkim_verify_handler (lua_State *L)
rspamd_dkim_key_t *key;
gint ret;
GError *err = NULL;
+ const gchar *type_str = NULL;
+ enum rspamd_dkim_type type = RSPAMD_DKIM_NORMAL;
if (task && sig && lua_isfunction (L, 3)) {
+ if (lua_isstring (L, 4)) {
+ type_str = lua_tostring (L, 4);
+
+ if (type_str) {
+ if (strcmp (type_str, "dkim") == 0) {
+ type = RSPAMD_DKIM_NORMAL;
+ }
+ else if (strcmp (type_str, "arc-sign") == 0) {
+ type = RSPAMD_DKIM_ARC_SIG;
+ }
+ else if (strcmp (type_str, "arc-seal") == 0) {
+ type = RSPAMD_DKIM_ARC_SEAL;
+ }
+ else {
+ lua_settop (L, 0);
+ return luaL_error (L, "unknown sign type: %s",
+ type_str);
+ }
+ }
+ }
+
ctx = rspamd_create_dkim_context (sig,
task->task_pool,
dkim_module_ctx->time_jitter,
- RSPAMD_DKIM_NORMAL,
+ type,
&err);
if (ctx == NULL) {