From 6d0a965db25b6c479967f6879827702586cab6c2 Mon Sep 17 00:00:00 2001 From: rxu Date: Thu, 15 Aug 2024 23:47:37 +0700 Subject: [PATCH 1/2] [ticket/17383] Fix HELO/EHLO error in email messenger on PHP8 PHPBB-17383 --- phpBB/includes/functions_messenger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index f25ce82b8f..52ac89957c 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -1428,7 +1428,7 @@ class smtp_class if (($addr = @gethostbyname($local_host)) !== $local_host) { // Able to resolve IP back to name - if (($name = @gethostbyaddr($addr)) !== $addr) + if (!empty($name = @gethostbyaddr($addr)) && $name !== $addr) { $local_host = $name; } From cc4579ee043e6b71b878ad1d5ce0448757abfca2 Mon Sep 17 00:00:00 2001 From: rxu Date: Fri, 16 Aug 2024 00:30:40 +0700 Subject: [PATCH 2/2] [ticket/17383] Validate php_uname() output too PHPBB-17383 --- phpBB/includes/functions_messenger.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 52ac89957c..6781ec4e0f 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -1418,12 +1418,8 @@ class smtp_class global $user; // Here we try to determine the *real* hostname (reverse DNS entry preferrably) - $local_host = $user->host; - - if (function_exists('php_uname')) + if (function_exists('php_uname') && !empty($local_host = php_uname('n'))) { - $local_host = php_uname('n'); - // Able to resolve name to IP if (($addr = @gethostbyname($local_host)) !== $local_host) { @@ -1434,6 +1430,10 @@ class smtp_class } } } + else + { + $local_host = $user->host; + } // If we are authenticating through pop-before-smtp, we // have to login ones before we get authenticated