From: Vsevolod Stakhov Date: Mon, 1 Aug 2016 16:04:58 +0000 (+0100) Subject: [Fix] Do not cache SPF records with DNS errors X-Git-Tag: 1.3.2~85 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c75906d95cbda6828fbfe4e282a98a3e77d50c42;p=thirdparty%2Frspamd.git [Fix] Do not cache SPF records with DNS errors --- diff --git a/src/plugins/spf.c b/src/plugins/spf.c index 5a12d3c7c8..691f50964c 100644 --- a/src/plugins/spf.c +++ b/src/plugins/spf.c @@ -369,14 +369,16 @@ spf_plugin_callback (struct spf_resolved *record, struct rspamd_task *task, if (record && record->elts->len > 0 && record->domain) { - if ((l = - rspamd_lru_hash_lookup (spf_module_ctx->spf_hash, - record->domain, task->tv.tv_sec)) == NULL) { + if ((l = rspamd_lru_hash_lookup (spf_module_ctx->spf_hash, + record->domain, task->tv.tv_sec)) == NULL) { l = spf_record_ref (record); - rspamd_lru_hash_insert (spf_module_ctx->spf_hash, - record->domain, l, - task->tv.tv_sec, record->ttl); + + if (!record->failed) { + rspamd_lru_hash_insert (spf_module_ctx->spf_hash, + record->domain, l, + task->tv.tv_sec, record->ttl); + } } spf_record_ref (l); @@ -406,6 +408,7 @@ spf_symbol_callback (struct rspamd_task *task, void *unused) } domain = rspamd_spf_get_domain (task); + if (domain) { if ((l = rspamd_lru_hash_lookup (spf_module_ctx->spf_hash, domain,