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;
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);