From c594689abf8dad487c16615d451f11021ac8de68 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 13 May 2011 20:02:17 +0400 Subject: [PATCH] Add more options to rspamc client. Remove unused scores. --- src/client/rspamc.c | 20 ++++++++++++++++++++ src/settings.c | 20 -------------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/client/rspamc.c b/src/client/rspamc.c index 155db86c6..260581d47 100644 --- a/src/client/rspamc.c +++ b/src/client/rspamc.c @@ -34,6 +34,10 @@ static gchar *connect_str = "localhost"; static gchar *password; static gchar *statfile; static gchar *ip; +static gchar *from; +static gchar *deliver_to; +static gchar *rcpt; +static gchar *user; static gint weight = 1; static gint flag; static gint timeout = 5; @@ -51,6 +55,10 @@ static GOptionEntry entries[] = { "pass", 'p', 0, G_OPTION_ARG_NONE, &pass_all, "Pass all filters", NULL }, { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "More verbose output", NULL }, { "ip", 'i', 0, G_OPTION_ARG_STRING, &ip, "Emulate that message was received from specified ip address", NULL }, + { "user", 'u', 0, G_OPTION_ARG_STRING, &user, "Emulate that message was from specified user", NULL }, + { "deliver", 'd', 0, G_OPTION_ARG_STRING, &deliver_to, "Emulate that message is delivered to specified user", NULL }, + { "from", 'F', 0, G_OPTION_ARG_STRING, &from, "Emulate that message is from specified user", NULL }, + { "rcpt", 'r', 0, G_OPTION_ARG_STRING, &rcpt, "Emulate that message is for specified user", NULL }, { "timeout", 't', 0, G_OPTION_ARG_INT, &timeout, "Timeout for waiting for a reply", NULL }, { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL } }; @@ -289,6 +297,18 @@ add_options (GHashTable *opts) if (ip != NULL) { g_hash_table_insert (opts, "Ip", ip); } + if (from != NULL) { + g_hash_table_insert (opts, "From", from); + } + if (user != NULL) { + g_hash_table_insert (opts, "User", user); + } + if (rcpt != NULL) { + g_hash_table_insert (opts, "Rcpt", rcpt); + } + if (deliver_to != NULL) { + g_hash_table_insert (opts, "Deliver-To", deliver_to); + } if (pass_all) { g_hash_table_insert (opts, "Pass", "all"); } diff --git a/src/settings.c b/src/settings.c index 6dd6cd3b0..1d0853f0a 100644 --- a/src/settings.c +++ b/src/settings.c @@ -438,22 +438,11 @@ check_metric_settings (struct worker_task * task, struct metric * metric, double { struct rspamd_settings *us = NULL, *ds = NULL; double *sc, *rs; - gboolean black; *rscore = DEFAULT_REJECT_SCORE; if (check_setting (task, &us, &ds)) { if (us != NULL) { - /* First look in user white list */ - if (check_bwhitelist(task, us, &black)) { - if (black) { - *score = -DEFAULT_REJECT_SCORE; - } - else { - *score = DEFAULT_REJECT_SCORE; - } - return TRUE; - } if ((rs = g_hash_table_lookup (us->reject_scores, metric->name)) != NULL) { *rscore = *rs; } @@ -471,15 +460,6 @@ check_metric_settings (struct worker_task * task, struct metric * metric, double } } else if (ds != NULL) { - if (check_bwhitelist(task, ds, &black)) { - if (black) { - *score = DEFAULT_REJECT_SCORE; - } - else { - *score = 0; - } - return TRUE; - } if ((rs = g_hash_table_lookup (ds->reject_scores, metric->name)) != NULL) { *rscore = *rs; } -- 2.39.5