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;
{ "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 }
};
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");
}
{
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;
}
}
}
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;
}