]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Core: Use quarantine/dicard as semi-standard actions
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 26 Jan 2019 17:11:55 +0000 (17:11 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 26 Jan 2019 17:11:55 +0000 (17:11 +0000)
src/libserver/cfg_file.h
src/libserver/cfg_utils.c
src/libserver/milter.c
src/libserver/protocol.c

index 8ecb84d263b274912f32e594bcefa34f0c37a59d..c7475c327033016515f6589e50ed8bb8d8d92934 100644 (file)
@@ -270,8 +270,8 @@ enum rspamd_action_type {
        METRIC_ACTION_NOACTION,
        METRIC_ACTION_MAX,
        METRIC_ACTION_CUSTOM = 999,
-       METRIC_ACTION_MILTER_DISCARD,
-       METRIC_ACTION_MILTER_QUARANTINE
+       METRIC_ACTION_DISCARD,
+       METRIC_ACTION_QUARANTINE
 };
 
 enum rspamd_action_flags {
index 0d3f1e75a3875fc8a3bd2214f21084a1f84167a8..d288c8e0611e4632c75453d9bf3ea8ebde60612d 100644 (file)
@@ -1937,11 +1937,11 @@ rspamd_config_action_from_ucl (struct rspamd_config *cfg,
 
                        if (strcmp (milter_action, "discard") == 0) {
                                flags |= RSPAMD_ACTION_MILTER;
-                               act->action_type = METRIC_ACTION_MILTER_DISCARD;
+                               act->action_type = METRIC_ACTION_DISCARD;
                        }
                        else if (strcmp (milter_action, "quarantine") == 0) {
                                flags |= RSPAMD_ACTION_MILTER;
-                               act->action_type = METRIC_ACTION_MILTER_QUARANTINE;
+                               act->action_type = METRIC_ACTION_QUARANTINE;
                        }
                        else {
                                msg_warn_config ("unknown milter action: %s", milter_action);
@@ -2239,6 +2239,12 @@ rspamd_action_from_str (const gchar *data, gint *result)
        case 0x167C0DF4BAA9BCECULL: /* accept */
                *result = METRIC_ACTION_NOACTION;
                break;
+       case 0x4E9666ECCD3FC314ULL: /* quarantine */
+               *result = METRIC_ACTION_QUARANTINE;
+               break;
+       case 0x93B346242F7F69B3ULL: /* discard */
+               *result = METRIC_ACTION_DISCARD;
+               break;
        default:
                return FALSE;
        }
@@ -2266,9 +2272,9 @@ rspamd_action_to_str (enum rspamd_action_type action)
                return "invalid max action";
        case METRIC_ACTION_CUSTOM:
                return "custom";
-       case METRIC_ACTION_MILTER_DISCARD:
+       case METRIC_ACTION_DISCARD:
                return "discard";
-       case METRIC_ACTION_MILTER_QUARANTINE:
+       case METRIC_ACTION_QUARANTINE:
                return "quarantine";
        }
 
@@ -2295,9 +2301,9 @@ rspamd_action_to_str_alt (enum rspamd_action_type action)
                return "invalid max action";
        case METRIC_ACTION_CUSTOM:
                return "custom";
-       case METRIC_ACTION_MILTER_DISCARD:
+       case METRIC_ACTION_DISCARD:
                return "discard";
-       case METRIC_ACTION_MILTER_QUARANTINE:
+       case METRIC_ACTION_QUARANTINE:
                return "quarantine";
        }
 
index b871c23475037f013b4ed5e638941ac4f6373c56..03aef8298c5b1a841b9034ce9c8b54fa6ea47b7d 100644 (file)
@@ -1947,7 +1947,7 @@ rspamd_milter_send_task_results (struct rspamd_milter_session *session,
                rspamd_milter_send_action (session, RSPAMD_MILTER_ACCEPT);
                break;
 
-       case METRIC_ACTION_MILTER_QUARANTINE:
+       case METRIC_ACTION_QUARANTINE:
                /* TODO: be more flexible about SMTP messages */
                rspamd_milter_send_action (session, RSPAMD_MILTER_QUARANTINE,
                                RSPAMD_MILTER_QUARANTINE_MESSAGE);
@@ -1955,7 +1955,7 @@ rspamd_milter_send_task_results (struct rspamd_milter_session *session,
                /* Quarantine also requires accept action, all hail Sendmail */
                rspamd_milter_send_action (session, RSPAMD_MILTER_ACCEPT);
                break;
-       case METRIC_ACTION_MILTER_DISCARD:
+       case METRIC_ACTION_DISCARD:
                rspamd_milter_send_action (session, RSPAMD_MILTER_DISCARD);
                break;
        case METRIC_ACTION_GREYLIST:
index d8c790e8f0bce718521617f520170ee189ce4958..574c5fa9f89c4375791b3a29f27e6b9b1da7c281 100644 (file)
@@ -970,11 +970,11 @@ rspamd_metric_result_ucl (struct rspamd_task *task,
        }
        if (action->flags & RSPAMD_ACTION_MILTER) {
                /* Treat milter action specially */
-               if (action->action_type == METRIC_ACTION_MILTER_DISCARD) {
+               if (action->action_type == METRIC_ACTION_DISCARD) {
                        ucl_object_insert_key (obj, ucl_object_fromstring ("discard"),
                                        "reject", 0, false);
                }
-               else if (action->action_type == METRIC_ACTION_MILTER_QUARANTINE) {
+               else if (action->action_type == METRIC_ACTION_QUARANTINE) {
                        ucl_object_insert_key (obj, ucl_object_fromstring ("quarantine"),
                                        "reject", 0, false);
                }