diff --git a/app/Jobs/MessageProcess.php b/app/Jobs/MessageProcess.php index 8d378ab..ac8d873 100644 --- a/app/Jobs/MessageProcess.php +++ b/app/Jobs/MessageProcess.php @@ -236,7 +236,7 @@ class MessageProcess implements ShouldQueue ->single(); if (! $ea) { - Log::alert(sprintf('%s:! Echoarea [%s] doesnt exist for zone [%d]',self::LOGKEY,$this->msg->echoarea,$this->msg->fboss_o->zone->zone_id)); + Log::alert(sprintf('%s:! Echoarea [%s] doesnt exist for zone [%d-%d]',self::LOGKEY,$this->msg->echoarea,$this->msg->fboss_o->zone->domain_id,$this->msg->fboss_o->zone->zone_id)); Notification::route('netmail',$this->pktsrc)->notify(new EchoareaNotExist($this->msg)); return; @@ -244,6 +244,14 @@ class MessageProcess implements ShouldQueue Log::debug(sprintf('%s:- Processing echomail [%s] in [%s].',self::LOGKEY,$this->msg->msgid,$this->msg->echoarea)); + if (! $this->pktsrc->zone->domain->zones->pluck('zone_id')->contains($this->msg->fboss_o->zone->zone_id)) { + Log::alert(sprintf('%s:! The message [%s] is from a different zone [%d] than the packet sender [%d]', + self::LOGKEY, + $this->msg->msgid, + $this->msg->fboss_o->zone->zone_id, + $this->pktsrc->zone->zone_id)); + } + // Check for duplicate messages // FTS-0009.001 if ($this->msg->msgid) { @@ -295,16 +303,22 @@ class MessageProcess implements ShouldQueue } // @todo Can the sender create it if it doesnt exist? - // Can the system send messages to this area? if (! $ea->sec_write || ($this->pktsrc->security < $ea->sec_write)) { - Notification::route('netmail',$this->pktsrc)->notify(new EchoareaNoWrite($this->msg)); + Log::alert(sprintf('%s:! FTN [%s] is not allowed to post [%s] to [%s].',self::LOGKEY,$this->msg->fboss,$this->msg->msgid,$ea->name)); + if (! $this->msg->rescanned->count()) + Notification::route('netmail',$this->pktsrc)->notify(new EchoareaNoWrite($this->msg)); + return; } // If the node is not subscribed - if ($this->pktsrc->echoareas->search(function($item) use ($ea) { return $item->id === $ea->id; }) === FALSE) - Notification::route('netmail',$this->pktsrc)->notify(new EchoareaNotSubscribed($this->msg)); + if ($this->pktsrc->echoareas->search(function($item) use ($ea) { return $item->id === $ea->id; }) === FALSE) { + Log::alert(sprintf('%s:! FTN [%s] is not subscribed to [%s] for [%s].',self::LOGKEY,$this->msg->fboss,$ea->name,$this->msg->msgid)); + + if (! $this->msg->rescanned->count()) + Notification::route('netmail',$this->pktsrc)->notify(new EchoareaNotSubscribed($this->msg)); + } // We know about this area, store it $o = new Echomail; diff --git a/app/Models/Address.php b/app/Models/Address.php index ee396f3..b88590c 100644 --- a/app/Models/Address.php +++ b/app/Models/Address.php @@ -530,7 +530,7 @@ class Address extends Model $do = $zo?->domain; } - if ($do && $do->flatten) + if ($do && $do->flatten && (($ftn['z'] === 0) || $do->zones->pluck('zone_id')->contains($ftn['z']))) $o = self::findZone($do,$ftn['n'],$ftn['f'],$ftn['p'],$trashed); }