}
static gboolean
-parse_spf_exists(struct spf_record *rec, struct spf_addr *addr)
+parse_spf_exists(struct spf_record *rec,
+ struct spf_resolved_element *resolved, struct spf_addr *addr)
{
struct spf_dns_cb *cb;
const char *host;
struct rspamd_task *task = rec->task;
- struct spf_resolved_element *resolved;
- resolved = g_ptr_array_index(rec->resolved, rec->resolved->len - 1);
CHECK_REC(rec);
/* Check if element has unresolved macros */
}
else if (g_ascii_strncasecmp(begin, SPF_EXISTS,
sizeof(SPF_EXISTS) - 1) == 0) {
- res = parse_spf_exists(rec, addr);
+ res = parse_spf_exists(rec, resolved, addr);
}
else {
msg_notice_spf("spf error for domain %s: bad spf command %s",
Expect Symbol R_SPF_FAIL
Do Not Expect Symbol R_SPF_ALLOW
+SPF ALLOW EXISTS
+ [Documentation] RFC 7208 5.7: an exists element whose name resolves matches
+ ... any sender, here it follows an include that has appended an element of
+ ... its own to the record
+ Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml
+ ... IP=8.8.8.8 From=x@exists.org.org.za
+ ... Settings=${SETTINGS_SPF}
+ Expect Symbol R_SPF_ALLOW
+
+SPF FAIL UNRESOLVEABLE EXISTS
+ [Documentation] An exists element whose name does not resolve matches
+ ... nothing, so the trailing -all applies
+ Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml
+ ... IP=8.8.8.8 From=x@noexists.org.org.za
+ ... Settings=${SETTINGS_SPF}
+ Expect Symbol R_SPF_FAIL
+ Do Not Expect Symbol R_SPF_ALLOW
+
SPF DNS REQUESTS LIMIT
[Documentation] Exactly max_dns_requests DNS elements (30 by default) are
... evaluated, the 31st one is not, so only the shorter record authorises
{name = "pad.req.org.org.za", type = "aaaa", rcode = "norec"},
{name = "hit.req.org.org.za", type = "a", replies = ["8.8.8.8"]},
{name = "hit.req.org.org.za", type = "aaaa", rcode = "norec"},
+ # 117_spf: exists elements preceded by an include, so that the include
+ # has already appended an element of its own to the record
+ {name = "exists.org.org.za", type = "txt",
+ replies = ["v=spf1 include:inc.exists.org.org.za exists:probe.exists.org.org.za -all"]},
+ {name = "noexists.org.org.za", type = "txt",
+ replies = ["v=spf1 include:inc.exists.org.org.za exists:absent.exists.org.org.za -all"]},
+ {name = "inc.exists.org.org.za", type = "txt",
+ replies = ["v=spf1 ip4:192.0.2.40 -all"]},
+ {name = "probe.exists.org.org.za", type = "a", replies = ["127.0.0.2"]},
+ {name = "absent.exists.org.org.za", type = "a", rcode = "nxdomain"},
{
name = "fail7.org.org.za",
type = "aaaa";