From 7ca4428c160996f82aa130e2aeb288dffdb2764f Mon Sep 17 00:00:00 2001 From: yehudah Date: Mon, 7 May 2018 11:23:42 +0000 Subject: add support for ptr conflicts on hostname git-svn-id: https://plugins.svn.wordpress.org/post-smtp/trunk@1869938 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- Postman/PostmanUtils.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Postman/PostmanUtils.php b/Postman/PostmanUtils.php index 7eaebe5..8d5cd46 100644 --- a/Postman/PostmanUtils.php +++ b/Postman/PostmanUtils.php @@ -452,6 +452,29 @@ class PostmanUtils { $result = php_uname('n'); } + if ( $result !== 'localhost.localdomain' ) { + // get the current result ip + $ip = gethostbyname($result); + + // dns query failed + if ( $ip == $result ) { + return $result; + } + + // get the current ip hostname - reverse dns + $host = gethostbyaddr($ip); + + // dns query failed + if ( $host == $ip ) { + return $result; + } + + // if hostname is not equal to the result set the ptr + if ( $result !== $host ) { + $result = $host; + } + } + return $result; } -- cgit v1.2.3