aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/spf.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-09-30 23:16:21 +0100
committerGitHub <noreply@github.com>2016-09-30 23:16:21 +0100
commitcbe06dc277cb74e0d08842d65706893e29f0abd8 (patch)
tree4e3e8de6e6b09b759a38d6aaa43682e821e4a9a6 /src/plugins/spf.c
parent59889bfc11fc176bf82743fbeeedd258ff94f563 (diff)
parentb561e9b9cbd86191aec1e51cc776d083b66b14b5 (diff)
downloadrspamd-cbe06dc277cb74e0d08842d65706893e29f0abd8.tar.gz
rspamd-cbe06dc277cb74e0d08842d65706893e29f0abd8.zip
Merge pull request #988 from fatalbanana/localauth
[Minor] Allow for re-enabling default-disabled checks
Diffstat (limited to 'src/plugins/spf.c')
-rw-r--r--src/plugins/spf.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/plugins/spf.c b/src/plugins/spf.c
index aa09eecac..d01f2b4da 100644
--- a/src/plugins/spf.c
+++ b/src/plugins/spf.c
@@ -57,6 +57,9 @@ struct spf_ctx {
rspamd_mempool_t *spf_pool;
radix_compressed_t *whitelist_ip;
rspamd_lru_hash_t *spf_hash;
+
+ gboolean check_local;
+ gboolean check_authed;
};
static struct spf_ctx *spf_module_ctx = NULL;
@@ -196,6 +199,20 @@ spf_module_config (struct rspamd_config *cfg)
spf_module_ctx->whitelist_ip = radix_create_compressed ();
if ((value =
+ rspamd_config_get_module_opt (cfg, "options", "check_local")) != NULL) {
+ spf_module_ctx->check_local = ucl_obj_toboolean (value);
+ }
+ else {
+ spf_module_ctx->check_local = FALSE;
+ }
+ if ((value =
+ rspamd_config_get_module_opt (cfg, "options", "check_authed")) != NULL) {
+ spf_module_ctx->check_authed = ucl_obj_toboolean (value);
+ }
+ else {
+ spf_module_ctx->check_authed = FALSE;
+ }
+ if ((value =
rspamd_config_get_module_opt (cfg, "spf", "symbol_fail")) != NULL) {
spf_module_ctx->symbol_fail = ucl_obj_tostring (value);
}
@@ -535,7 +552,8 @@ spf_symbol_callback (struct rspamd_task *task, void *unused)
return;
}
- if (task->user != NULL || rspamd_inet_address_is_local (task->from_addr)) {
+ if ((!spf_module_ctx->check_authed && task->user != NULL)
+ || (!spf_module_ctx->check_local && rspamd_inet_address_is_local (task->from_addr))) {
msg_info_task ("skip SPF checks for local networks and authorized users");
return;
}