validate result of Net_DNS2_Resolver::query (CNAME's are being resolved to their corresponding target A/AAAA addresses); fixes #1089

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2023-01-23 08:58:42 +01:00
parent 314e4407a0
commit d090e48544

View File

@@ -263,7 +263,9 @@ class PhpHelper
try {
$answer = $resolver->query($host, 'A')->answer;
foreach ($answer as $rr) {
$ips[] = inet_ntop(inet_pton($rr->address));
if ($rr instanceof Net_DNS2_RR_A) {
$ips[] = inet_ntop(inet_pton($rr->address));
}
}
} catch (Net_DNS2_Exception $e) {
// we can't do anything here, just continue
@@ -274,7 +276,9 @@ class PhpHelper
try {
$answer = $resolver->query($host, 'AAAA')->answer;
foreach ($answer as $rr) {
$ips[] = inet_ntop(inet_pton($rr->address));
if ($rr instanceof Net_DNS2_RR_AAAA) {
$ips[] = inet_ntop(inet_pton($rr->address));
}
}
} catch (Net_DNS2_Exception $e) {
// we can't do anything here, just continue