[Web] Fix loop in SPF lookup

This commit is contained in:
andryyy 2019-08-16 18:20:58 +02:00
parent 6e41fa9fc1
commit 692614f79e
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF

View File

@ -1,11 +1,11 @@
<?php <?php
error_reporting(0); error_reporting(0);
function get_spf_allowed_hosts($domain) function get_spf_allowed_hosts($check_domain)
{ {
$hosts = array(); $hosts = array();
$records = dns_get_record($domain, DNS_TXT); $records = dns_get_record($check_domain, DNS_TXT);
foreach ($records as $record) foreach ($records as $record)
{ {
$txt = explode(' ', $record['entries'][0]); $txt = explode(' ', $record['entries'][0]);
@ -47,7 +47,7 @@ function get_spf_allowed_hosts($domain)
} }
$new_hosts = array(); $new_hosts = array();
if ($mech == 'include') // handle an inclusion if ($mech == 'include' && $check_domain != $domain) // handle an inclusion
{ {
$new_hosts = get_spf_allowed_hosts($domain); $new_hosts = get_spf_allowed_hosts($domain);
} }
@ -134,4 +134,4 @@ function get_outgoing_hosts_best_guess($domain)
// fall back to the A record to get the host name for this domain // fall back to the A record to get the host name for this domain
return get_a_hosts($domain); return get_a_hosts($domain);
} }
?> ?>