Fix for DNS query's using the domain's dnsdomain
This commit is contained in:
parent
485d67b366
commit
ed43aaa878
@ -182,8 +182,11 @@ final class DNS extends BaseProtocol
|
|||||||
if (is_null($z=$this->parse('z',$labels->shift())))
|
if (is_null($z=$this->parse('z',$labels->shift())))
|
||||||
return $this->nameerr();
|
return $this->nameerr();
|
||||||
|
|
||||||
if (is_null($d=$labels->shift()))
|
// If the query doesnt end with .ftn, then the remainder of the query is the domain name
|
||||||
return $this->nameerr();
|
if (($labels->search(self::TLD) !== FALSE))
|
||||||
|
$d = $labels->shift();
|
||||||
|
else
|
||||||
|
$d = '';
|
||||||
|
|
||||||
// Make sure we have a root/base domain
|
// Make sure we have a root/base domain
|
||||||
if (! $labels->count())
|
if (! $labels->count())
|
||||||
@ -191,15 +194,18 @@ final class DNS extends BaseProtocol
|
|||||||
|
|
||||||
$rootdn = $labels->join('.');
|
$rootdn = $labels->join('.');
|
||||||
|
|
||||||
|
if (! $d && ($rootdn !== self::TLD))
|
||||||
|
$d = Domain::where('dnsdomain',$rootdn)->single()?->name;
|
||||||
|
|
||||||
$ao = Address::findFTN(sprintf('%d:%d/%d.%d@%s',$z,$n,$f,$p,$d));
|
$ao = Address::findFTN(sprintf('%d:%d/%d.%d@%s',$z,$n,$f,$p,$d));
|
||||||
|
|
||||||
// Check we have the right record
|
// Check we have the right record
|
||||||
if ((! $ao) || (! $ao->system->address) || (($rootdn !== self::TLD) && ((! $ao->zone->domain->dnsdomain) || ($ao->zone->domain->dnsdomain !== $d.'.'.$rootdn)))) {
|
if ((! $ao) || (! $ao->system->address) || (($rootdn !== self::TLD) && ((! $ao->zone->domain->dnsdomain) || ($ao->zone->domain->dnsdomain !== $rootdn)))) {
|
||||||
Log::alert(sprintf('%s:= No DNS record for [%d:%d/%d.%d@%s]',self::LOGKEY,$z,$n,$f,$p,$d));
|
Log::alert(sprintf('%s:= No DNS record for [%d:%d/%d.%d@%s]',self::LOGKEY,$z,$n,$f,$p,$d));
|
||||||
return $this->nameerr();
|
return $this->nameerr();
|
||||||
}
|
}
|
||||||
|
|
||||||
Log::debug(sprintf('%s:= Returning [%s] for DNS query [%s]',self::LOGKEY,$ao->system->address,$ao->ftn));
|
Log::info(sprintf('%s:= Returning [%s] for DNS query [%s]',self::LOGKEY,$ao->system->address,$ao->ftn));
|
||||||
|
|
||||||
return $this->reply(
|
return $this->reply(
|
||||||
self::DNS_NOERROR,
|
self::DNS_NOERROR,
|
||||||
|
Loading…
Reference in New Issue
Block a user