Browse Source

[Web] Fix loop in SPF lookup

andryyy 6 years ago
parent
commit
692614f79e
1 changed files with 4 additions and 4 deletions
  1. 4 4
      data/web/inc/spf.inc.php

+ 4 - 4
data/web/inc/spf.inc.php

@@ -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);
 }
 }
-?>
+?>