]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Use quarantine message
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 24 Nov 2017 19:08:25 +0000 (19:08 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 24 Nov 2017 19:08:25 +0000 (19:08 +0000)
src/libserver/milter.c
src/libserver/milter_internal.h

index 7874a9dbcd314730043e5d698d115c2e8f717c3e..c201e2ee9b8afecc32e5330d39c2bc2fe26de4a0 100644 (file)
@@ -1139,7 +1139,9 @@ rspamd_milter_send_action (struct rspamd_milter_session *session,
        va_list ap;
        guchar cmd, *pos;
        rspamd_fstring_t *reply = NULL;
+       gsize len;
        GString *name, *value;
+       const char *reason;
        struct rspamd_milter_outbuf *obuf;
        struct rspamd_milter_private *priv = session->priv;
 
@@ -1156,6 +1158,17 @@ rspamd_milter_send_action (struct rspamd_milter_session *session,
                /* No additional arguments */
                SET_COMMAND (cmd, 0, reply, pos);
                break;
+       case RSPAMD_MILTER_QUARANTINE:
+               reason = va_arg (ap, const char *);
+
+               if (reason == NULL) {
+                       reason = "";
+               }
+
+               len = strlen (reason);
+               SET_COMMAND (cmd, len + 1, reply, pos);
+               memcpy (pos, reason, len + 1);
+               break;
        case RSPAMD_MILTER_ADDHEADER:
                name = va_arg (ap, GString *);
                value = va_arg (ap, GString *);
@@ -1721,8 +1734,9 @@ rspamd_milter_send_task_results (struct rspamd_milter_session *session,
                        rspamd_milter_send_action (session, RSPAMD_MILTER_DISCARD);
                }
                else if (priv->quarantine_on_reject) {
-                       /* TODO: need to add quarantine message */
-                       rspamd_milter_send_action (session, RSPAMD_MILTER_QUARANTINE);
+                       /* TODO: be more flexible about SMTP messages */
+                       rspamd_milter_send_action (session, RSPAMD_MILTER_QUARANTINE,
+                                       RSPAMD_MILTER_QUARANTINE_MESSAGE);
                }
                else {
                        rcode = rspamd_fstring_new_init (RSPAMD_MILTER_RCODE_REJECT,
index 6473ed14779bd9fe75b1afe42c11237e33105ef9..f44da9c93648de4e3bc1e5bc88d436bafac87c6b 100644 (file)
@@ -153,6 +153,7 @@ enum rspamd_milter_connect_proto {
 #define RSPAMD_MILTER_XCODE_REJECT "5.7.1"
 #define RSPAMD_MILTER_XCODE_TEMPFAIL "4.7.1"
 #define RSPAMD_MILTER_REJECT_MESSAGE "Spam message rejected"
+#define RSPAMD_MILTER_QUARANTINE_MESSAGE "Spam message quarantined"
 #define RSPAMD_MILTER_TEMPFAIL_MESSAGE "Try again later"
 #define RSPAMD_MILTER_SPAM_HEADER "X-Spam"
 #define RSPAMD_MILTER_DKIM_HEADER "DKIM-Signature"