From 0be305734dfb56231d592fa7b134dc66e5058cb3 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 --- 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