Browse Source

[Fix] Do not cache SPF records with macros

tags/1.6.2
Vsevolod Stakhov 7 years ago
parent
commit
6a2fcfc30c
2 changed files with 10 additions and 1 deletions
  1. 6
    0
      src/libserver/spf.c
  2. 4
    1
      src/plugins/spf.c

+ 6
- 0
src/libserver/spf.c View File

@@ -1580,6 +1580,12 @@ expand_spf_macro (struct spf_record *rec, struct spf_resolved_element *resolved,

new = rspamd_mempool_alloc (task->task_pool, len + 1);

/* Reduce TTL to avoid caching of records with macros */
if (rec->ttl != 0) {
rec->ttl = 0;
msg_debug_spf ("disable SPF caching as there is macro expansion");
}

c = new;
p = begin;
state = 0;

+ 4
- 1
src/plugins/spf.c View File

@@ -529,7 +529,10 @@ spf_plugin_callback (struct spf_resolved *record, struct rspamd_task *task,

l = spf_record_ref (record);

if (!record->temp_failed && !record->perm_failed && !record->na) {
if (record->ttl > 0 &&
!record->temp_failed &&
!record->perm_failed &&
!record->na) {
rspamd_lru_hash_insert (spf_module_ctx->spf_hash,
record->domain, l,
task->tv.tv_sec, record->ttl);

Loading…
Cancel
Save