summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libserver/cfg_file.h2
-rw-r--r--src/libserver/protocol.c6
-rw-r--r--src/lua/lua_task.c7
3 files changed, 9 insertions, 6 deletions
diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h
index d96c6e474..48f352f49 100644
--- a/src/libserver/cfg_file.h
+++ b/src/libserver/cfg_file.h
@@ -269,7 +269,7 @@ struct rspamd_metric {
gdouble unknown_weight; /**< weight of unknown symbols */
gdouble grow_factor; /**< grow factor for metric */
GHashTable *symbols; /**< weights of symbols in metric */
- gchar *subject; /**< subject rewrite string */
+ const gchar *subject; /**< subject rewrite string */
GHashTable * groups; /**< groups of symbols */
struct metric_action actions[METRIC_ACTION_MAX]; /**< all actions of the metric */
};
diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c
index b012aee08..69427e8b5 100644
--- a/src/libserver/protocol.c
+++ b/src/libserver/protocol.c
@@ -747,7 +747,11 @@ make_rewritten_subject (struct rspamd_metric *metric, struct rspamd_task *task)
const gchar *s, *c, *p;
gsize slen = 0;
- c = metric->subject;
+ c = rspamd_mempool_get_variable (task->task_pool, "metric_subject");
+
+ if (c == NULL) {
+ c = metric->subject;
+ }
if (c == NULL) {
c = SPAM_SUBJECT;
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 9d139044f..614c059dd 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -4080,13 +4080,12 @@ lua_task_set_metric_subject (lua_State *L)
{
struct rspamd_task *task = lua_check_task (L, 1);
const gchar *subject;
- struct rspamd_metric *metric;
- metric = task->cfg->default_metric;
subject = luaL_checkstring (L, 2);
- if (task && metric && subject) {
- metric->subject = rspamd_mempool_strdup (task->task_pool, subject);
+ if (task && subject) {
+ rspamd_mempool_set_variable (task->task_pool, "metric_subject",
+ rspamd_mempool_strdup(task->task_pool, subject), NULL);
lua_pushboolean (L, true);
}
else {