]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Improve dkim signature readability (unfinished)
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 2 Apr 2018 13:58:31 +0000 (14:58 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 2 Apr 2018 13:58:31 +0000 (14:58 +0100)
src/libserver/dkim.c

index 5daa2cdafbec05780836550740f284d2dc98b4ee..94f5c39f70129996a2c7183c69608ef1331255bf 100644 (file)
@@ -2728,6 +2728,7 @@ rspamd_dkim_sign (struct rspamd_task *task, const gchar *selector,
        gchar *b64_data;
        guchar *rsa_buf;
        guint rsa_len;
+       guint headers_len = 0;
 
        g_assert (ctx != NULL);
 
@@ -2806,10 +2807,17 @@ rspamd_dkim_sign (struct rspamd_task *task, const gchar *selector,
                                        NULL, NULL);
                }
 
+               headers_len += (strlen (dh->name) + 1) * (dh->count + 1);
+
                /* We allow oversigning if dh->count > number of headers with this name */
                for (j = 0; j < dh->count + 1; j++) {
                        rspamd_printf_gstring (hdr, "%s:", dh->name);
                }
+
+               if (headers_len > 60 && i < ctx->common.hlist->len - 1) {
+                       rspamd_printf_gstring (hdr, "  ");
+                       headers_len = 0;
+               }
        }
 
        /* Replace the last ':' with ';' */