diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/src/dnsbl.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/src/dnsbl.c b/src/src/dnsbl.c index d3afd5cf8..5c6a76d94 100644 --- a/src/src/dnsbl.c +++ b/src/src/dnsbl.c @@ -247,7 +247,15 @@ if (cb->rc == DNS_SUCCEED) ignore IPv6 addresses. The default mask is 0, which always matches. We change this only for IPv4 addresses in the list. */ - if (host_aton(da->address, address) == 1) mask = address[0]; + if (host_aton(da->address, address) == 1) + if ((address[0] & 0xff000000) != 0x7f000000) /* 127.0.0.0/8 */ + log_write(0, LOG_MAIN, + "DNS list lookup for %s at %s returned %s;" + " not in 127.0/8 and discarded", + keydomain, domain, da->address); + + else + mask = address[0]; /* Scan the returned addresses, skipping any that are IPv6 */ @@ -301,6 +309,29 @@ if (cb->rc == DNS_SUCCEED) } } + /* No address list check; discard any illegal returns and give up if + none remain. */ + + else + { + BOOL ok = FALSE; + for (da = cb->rhs; da; da = da->next) + { + int address[4]; + + if ( host_aton(da->address, address) == 1 /* ipv4 */ + && (address[0] & 0xff000000) == 0x7f000000 /* 127.0.0.0/8 */ + ) + ok = TRUE; + else + log_write(0, LOG_MAIN, + "DNS list lookup for %s at %s returned %s;" + " not in 127.0/8 and discarded", + keydomain, domain, da->address); + } + if (!ok) return FAIL; + } + /* Either there was no IP list, or the record matched, implying that the domain is on the list. We now want to find a corresponding TXT record. If an alternate domain is specified for the TXT record, call this function |