diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-05-25 12:59:37 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-05-25 12:59:37 +0100 |
commit | e92880bca977398cbf3e163f6d0beeef92622430 (patch) | |
tree | 0219356a71781aac42e4652551d1ef274557a30a | |
parent | cfdaf9f05b3d8cdefcd51b36e4d280051e9be811 (diff) | |
download | rspamd-e92880bca977398cbf3e163f6d0beeef92622430.tar.gz rspamd-e92880bca977398cbf3e163f6d0beeef92622430.zip |
[Minor] Implement arc-signatures generation
-rw-r--r-- | src/libserver/dkim.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/libserver/dkim.c b/src/libserver/dkim.c index 033fce15c..0339d5d58 100644 --- a/src/libserver/dkim.c +++ b/src/libserver/dkim.c @@ -2283,14 +2283,33 @@ rspamd_dkim_sign (struct rspamd_task *task, } hdr = g_string_sized_new (255); - rspamd_printf_gstring (hdr, "v=1; a=rsa-sha256; c=%s/%s; d=%s; s=%s; ", - ctx->common.header_canon_type == DKIM_CANON_RELAXED ? "relaxed" : "simple", - ctx->common.body_canon_type == DKIM_CANON_RELAXED ? "relaxed" : "simple", - domain, selector); + + if (ctx->common.type == RSPAMD_DKIM_NORMAL) { + rspamd_printf_gstring (hdr, "v=1; a=rsa-sha256; c=%s/%s; d=%s; s=%s; ", + ctx->common.header_canon_type == DKIM_CANON_RELAXED ? + "relaxed" : "simple", + ctx->common.body_canon_type == DKIM_CANON_RELAXED ? + "relaxed" : "simple", + domain, selector); + } + else if (ctx->common.type == RSPAMD_DKIM_ARC_SIG) { + rspamd_printf_gstring (hdr, "i=%d; a=rsa-sha256; c=%s/%s; d=%s; s=%s; ", + idx, + ctx->common.header_canon_type == DKIM_CANON_RELAXED ? + "relaxed" : "simple", + ctx->common.body_canon_type == DKIM_CANON_RELAXED ? + "relaxed" : "simple", + domain, selector); + } + else { + /* Shouldn't be called for arc seal */ + g_assert_not_reached (); + } if (expire > 0) { rspamd_printf_gstring (hdr, "x=%t; ", expire); } + if (len > 0) { rspamd_printf_gstring (hdr, "l=%z; ", len); } |