diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-08-25 15:55:36 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-08-25 15:55:36 +0100 |
commit | c74537dcb18482394f04787f14e07730bffe841d (patch) | |
tree | cc47f5aed23646d9a8f818818c8d252d5134902a /src | |
parent | 9704de005f2278fc03155ae7d2ded89c78ed1e07 (diff) | |
download | rspamd-c74537dcb18482394f04787f14e07730bffe841d.tar.gz rspamd-c74537dcb18482394f04787f14e07730bffe841d.zip |
Allow to set the full result when using rspamd as lda.
Diffstat (limited to 'src')
-rw-r--r-- | src/client/rspamc.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/client/rspamc.c b/src/client/rspamc.c index b4d266bf0..31075e8f3 100644 --- a/src/client/rspamc.c +++ b/src/client/rspamc.c @@ -837,6 +837,14 @@ rspamd_action_from_str (const gchar *data, gint *result) sizeof ("soft reject") - 1) == 0) { *result = METRIC_ACTION_SOFT_REJECT; } + else if (g_ascii_strncasecmp (data, "no_action", + sizeof ("soft_reject") - 1) == 0) { + *result = METRIC_ACTION_NOACTION; + } + else if (g_ascii_strncasecmp (data, "no action", + sizeof ("soft reject") - 1) == 0) { + *result = METRIC_ACTION_NOACTION; + } else { return FALSE; } @@ -855,6 +863,7 @@ rspamc_mime_output (FILE *out, ucl_object_t *result, GString *input) gint act; gboolean is_spam = FALSE; const gchar *hdr_scanned, *hdr_spam; + gchar *json_header, *json_header_encoded; ar.data = input->str; ar.len = input->len; @@ -898,6 +907,23 @@ rspamc_mime_output (FILE *out, ucl_object_t *result, GString *input) g_mime_object_append_header (GMIME_OBJECT (message), "X-Spam-Action", action); + if (json || raw) { + /* We also append json data as a specific header */ + if (json) { + json_header = ucl_object_emit (result, UCL_EMIT_JSON); + } + else { + json_header = ucl_object_emit (result, UCL_EMIT_CONFIG); + } + + json_header_encoded = rspamd_encode_base64_fold (json_header, + strlen (json_header), 60, NULL); + free (json_header); + g_mime_object_append_header (GMIME_OBJECT (message), "X-Spam-Result", + json_header_encoded); + g_free (json_header_encoded); + } + /* Write message */ stream = g_mime_stream_file_new (out); g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream), FALSE); |