summaryrefslogtreecommitdiff
path: root/Postman
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
commit7ca4428c160996f82aa130e2aeb288dffdb2764f (patch)
treebca7577ff6bc92ed1cc53663e7bbec7eee2e6171 /Postman
parent12d16089bfb6a3589bcaa8fcd8d7fcb5a9cd216d (diff)
downloadPost-SMTP-7ca4428c160996f82aa130e2aeb288dffdb2764f.zip
add support for ptr conflicts on hostname
git-svn-id: https://plugins.svn.wordpress.org/post-smtp/trunk@1869938 b8457f37-d9ea-0310-8a92-e5e31aec5664
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;
}