Project

General

Profile

« Previous | Next » 

Revision 7829c6d5

Added by Renato Botelho almost 9 years ago

Fix diag_dns ipaddr set to use in IP WHOIS and IP Info

- Do not call resolve_host_addresses() when hostname cannot be resolved
by gethostbyname(). The old check was considering gethostbyname would
return NULL in this case but it returns a string with the hostname
passed on parameter
- Since resolve_host_addresses() always return an array, look for the
first A record to set $ipaddr, which will be used later to link with
IP WHOIS and IP Info

Based on Pull Request #3100 submitted by @NewEraCracker

View differences:

src/usr/local/www/diag_dns.php
168 168
		} elseif (is_hostname($host)) {
169 169
			$type = "hostname";
170 170
			$resolved = gethostbyname($host);
171
			if ($resolved) {
172
				$resolved = resolve_host_addresses($host);
173
			}
174 171
			if ($host != $resolved) {
175
				$ipaddr = $resolved[0];
172
				$resolved = resolve_host_addresses($host);
173
				foreach ($resolved as $item) {
174
					if ($item['type'] == 'A') {
175
						$ipaddr = $item['data'];
176
						break;
177
					}
178
				}
176 179
			}
177 180
		}
178 181

  

Also available in: Unified diff