summaryrefslogtreecommitdiff
path: root/Postman
diff options
context:
space:
mode:
Diffstat (limited to 'Postman')
-rw-r--r--Postman/PostmanUtils.php23
1 files changed, 23 insertions, 0 deletions
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;
}