1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-10-12 15:34:31 +02:00

Merge branch '3.3.x'

This commit is contained in:
Marc Alexander
2025-09-29 19:04:48 +00:00
2 changed files with 7 additions and 3 deletions

View File

@@ -1026,7 +1026,8 @@ function user_ipwhois($ip)
$match = array();
// Test for referrals from $whois_host to other whois databases, roll on rwhois
if (preg_match('#ReferralServer:[\x20]*whois://(.+)#im', $ipwhois, $match))
// Search for referral servers with or without the "whois://" prefix
if (preg_match('#ReferralServer:[\x20]*whois://(.+)#im', $ipwhois, $match) || preg_match('#ReferralServer:[\x20]*([^/]+)$#im', $ipwhois, $match))
{
if (strpos($match[1], ':') !== false)
{

View File

@@ -33,8 +33,10 @@ class phpbb_functions_user_whois_test extends phpbb_test_case
public static function ips_data()
{
return [
['2001:4860:4860::8888'], // Google public DNS
['64.233.161.139'], // google.com
['2001:4860:4860::8888'], // Google public DNS (ARIN)
['64.233.161.139'], // google.com (ARIN)
['1.1.1.1'], // Cloudflare (APNIC via whois:// referral)
['213.133.116.44'], // Hetzner (RIPE via non-whois:// referral)
];
}
@@ -47,5 +49,6 @@ class phpbb_functions_user_whois_test extends phpbb_test_case
$this->assertStringNotContainsString('Query terms are ambiguous', $ip_whois);
$this->assertStringNotContainsString('no entries found', $ip_whois);
$this->assertStringNotContainsString('ERROR', $ip_whois);
$this->assertStringNotContainsString('Allocated to RIPE NCC', $ip_whois); // This only shows if the referral isn't found
}
}