diff --git a/app/Classes/Protocol/DNS.php b/app/Classes/Protocol/DNS.php index bbc7b79..6bb6ca3 100644 --- a/app/Classes/Protocol/DNS.php +++ b/app/Classes/Protocol/DNS.php @@ -226,15 +226,18 @@ final class DNS extends BaseProtocol $ao = Address::findFTN(sprintf('%d:%d/%d.%d@%s',$z,$n,$f,$p,$d)); // Check we have the right record - if ((! $ao) || (! $ao->system->address) || (($rootdn !== self::TLD) && ((! $ao->zone->domain->dnsdomain) || ($ao->zone->domain->dnsdomain !== $rootdn)))) { + if ((! $ao) || (($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)); return $this->nameerr(); } - Log::info(sprintf('%s:= Returning [%s] for DNS query [%s]',self::LOGKEY,$ao->system->address,$ao->ftn)); - switch ($this->query->type) { case self::DNS_TYPE_SRV: + if (! $ao->system->address) + return $this->nameerr(); + + Log::info(sprintf('%s:= Returning [%s] for DNS query [%s]',self::LOGKEY,$ao->system->address,$ao->ftn)); + if ($xx=$ao->system->mailers->where('id',$mailer->id)->pop()) { return $this->reply( self::DNS_NOERROR, @@ -250,15 +253,20 @@ final class DNS extends BaseProtocol } case self::DNS_TYPE_TXT: + Log::info(sprintf('%s:= Returning [%s] for DNS query [%s]',self::LOGKEY,$ao->system->name,$ao->ftn)); + return $this->reply( self::DNS_NOERROR, [serialize($ao->system->name) => self::DNS_TYPE_TXT]); default: - return $this->reply( - self::DNS_NOERROR, - [serialize($this->domain_split($ao->system->address)) => self::DNS_TYPE_CNAME]); + Log::info(sprintf('%s:= Returning [%s] for DNS query [%s]',self::LOGKEY,$ao->system->address,$ao->ftn)); + return (! $ao->system->address) + ? $this->nameerr() + : $this->reply( + self::DNS_NOERROR, + [serialize($this->domain_split($ao->system->address)) => self::DNS_TYPE_CNAME]); } // Other attributes return NOTIMPL