]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Fix subject rewriting for the default subject.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 22 Sep 2014 12:25:15 +0000 (13:25 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 22 Sep 2014 12:25:15 +0000 (13:25 +0100)
Issue: #97
Submitted by: @eneq123

src/libserver/cfg_utils.c
src/libserver/protocol.c

index d5fbe70ac4a14d649316bb605c9dda227646f316..0a9fdc9ba55f48a1e086c56de7c26b97b3251ca8 100644 (file)
@@ -716,6 +716,7 @@ rspamd_config_new_metric (struct rspamd_config *cfg, struct metric *c)
                for (i = METRIC_ACTION_REJECT; i < METRIC_ACTION_MAX; i++) {
                        c->actions[i].score = -1.0;
                }
+               c->subject = SPAM_SUBJECT;
                rspamd_mempool_add_destructor (cfg->cfg_pool,
                        (rspamd_mempool_destruct_t) g_hash_table_destroy,
                        c->symbols);
index 26efc9b7cbbf3797e4b010135925472cccf253ed..e70e2d954a79919e043f3348ecc8e3a3e828983b 100644 (file)
@@ -551,11 +551,15 @@ static const gchar *
 make_rewritten_subject (struct metric *metric, struct rspamd_task *task)
 {
        static gchar subj_buf[1024];
-       gchar *p = subj_buf, *end, *c, *res;
-       const gchar *s;
+       gchar *p = subj_buf, *end, *res;
+       const gchar *s, *c;
 
        end = p + sizeof(subj_buf);
        c = metric->subject;
+       if (c == NULL) {
+               c = SPAM_SUBJECT;
+       }
+
        s = g_mime_message_get_subject (task->message);
 
        while (p < end) {