fix(dns): detect disabled IPv6 support in DNS pinning

Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
This commit is contained in:
Benjamin Gaussorgues 2024-03-26 10:25:06 +01:00
parent 47ac907149
commit 7e4be1fcfd
No known key found for this signature in database
GPG Key ID: 5DAC1CAFAA6DB883
1 changed files with 3 additions and 1 deletions

View File

@ -75,7 +75,9 @@ class DnsPinMiddleware {
$soaDnsEntry = $this->soaRecord($target);
$dnsNegativeTtl = $soaDnsEntry['minimum-ttl'] ?? null;
$dnsTypes = [DNS_A, DNS_AAAA, DNS_CNAME];
$dnsTypes = \defined('AF_INET6') || @inet_pton('::1')
? [DNS_A, DNS_AAAA, DNS_CNAME]
: [DNS_A, DNS_CNAME];
foreach ($dnsTypes as $dnsType) {
if ($this->negativeDnsCache->isNegativeCached($target, $dnsType)) {
continue;