aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-09-22 13:25:15 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-09-22 13:25:15 +0100
commit05a46b8f2181daf06170613ce382c0c7ba58c7ad (patch)
tree46577be41160216828ee239ac81ac916afc106ac /src/libserver
parentb3f9b35a520e348c655e184cbd429d03a12ca854 (diff)
downloadrspamd-05a46b8f2181daf06170613ce382c0c7ba58c7ad.tar.gz
rspamd-05a46b8f2181daf06170613ce382c0c7ba58c7ad.zip
Fix subject rewriting for the default subject.
Issue: #97 Submitted by: @eneq123
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/cfg_utils.c1
-rw-r--r--src/libserver/protocol.c8
2 files changed, 7 insertions, 2 deletions
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index d5fbe70ac..0a9fdc9ba 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -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);
diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c
index 26efc9b7c..e70e2d954 100644
--- a/src/libserver/protocol.c
+++ b/src/libserver/protocol.c
@@ -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) {