summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2018-05-07 11:23:42 +0000
committeryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2018-05-07 11:23:42 +0000
commit0be305734dfb56231d592fa7b134dc66e5058cb3 (patch)
treebca7577ff6bc92ed1cc53663e7bbec7eee2e6171
parent254f02d33c3362ff70e47a0fd7a84c8284e64e70 (diff)
downloadPost-SMTP-0be305734dfb56231d592fa7b134dc66e5058cb3.zip
add support for ptr conflicts on hostname
-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;
}