Better handling of badly addressed packets for netmails
This commit is contained in:
parent
86a15872b8
commit
7da09a1a9e
@ -878,11 +878,17 @@ class Message extends FTNBase
|
|||||||
$validator->after(function($validator) {
|
$validator->after(function($validator) {
|
||||||
if ($this->zone->domain->flatten) {
|
if ($this->zone->domain->flatten) {
|
||||||
if (! $this->zone->domain->zones->pluck('zone_id')->contains($this->fz))
|
if (! $this->zone->domain->zones->pluck('zone_id')->contains($this->fz))
|
||||||
$validator->errors()->add('invalid-zone',sprintf('Message zone [%d] doesnt match any zone in domain for packet zone [%d].',$this->fz,$this->zone->zone_id));
|
$validator->errors()->add('invalid-zone',sprintf('Message from zone [%d] doesnt match any zone in domain for packet zone [%d].',$this->fz,$this->zone->zone_id));
|
||||||
|
|
||||||
|
if (! $this->zone->domain->zones->pluck('zone_id')->contains($this->tz))
|
||||||
|
$validator->errors()->add('invalid-zone',sprintf('Message to zone [%d] doesnt match any zone in domain for packet zone [%d].',$this->fz,$this->zone->zone_id));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if ($this->zone->zone_id !== $this->fz)
|
if ($this->zone->zone_id !== $this->fz)
|
||||||
$validator->errors()->add('invalid-zone',sprintf('Message zone [%d] doesnt match packet zone [%d].',$this->fz,$this->zone->zone_id));
|
$validator->errors()->add('invalid-zone',sprintf('Message from zone [%d] doesnt match packet zone [%d].',$this->fz,$this->zone->zone_id));
|
||||||
|
|
||||||
|
if ($this->zone->zone_id !== $this->tz)
|
||||||
|
$validator->errors()->add('invalid-zone',sprintf('Message to zone [%d] doesnt match packet zone [%d].',$this->tz,$this->zone->zone_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $this->fftn)
|
if (! $this->fftn)
|
||||||
|
@ -386,9 +386,8 @@ abstract class Packet extends FTNBase implements \Iterator, \Countable
|
|||||||
|
|
||||||
// If the messages is not for the right zone, we'll ignore it
|
// If the messages is not for the right zone, we'll ignore it
|
||||||
if ($msg->errors->has('invalid-zone')) {
|
if ($msg->errors->has('invalid-zone')) {
|
||||||
Log::alert(sprintf('%s:! Message [%s] is from an invalid zone [%s], packet is from [%s] - ignoring it',self::LOGKEY,$msg->msgid,$msg->set_fftn,$this->fz));
|
Log::alert(sprintf('%s:! Message [%s] is from|to an invalid zone [%s|%s], packet is from [%s] - ignoring it',self::LOGKEY,$msg->msgid,$msg->get_fftn,$msg->get_tftn,$this->fz));
|
||||||
|
|
||||||
// @todo $msg might not be echomail
|
|
||||||
if (! $msg->kludges->get('RESCANNED'))
|
if (! $msg->kludges->get('RESCANNED'))
|
||||||
Notification::route('netmail',$this->fftn)->notify(($msg instanceof Echomail) ? new EchomailBadAddress($msg) : new NetmailBadAddress($msg));
|
Notification::route('netmail',$this->fftn)->notify(($msg instanceof Echomail) ? new EchomailBadAddress($msg) : new NetmailBadAddress($msg));
|
||||||
|
|
||||||
|
@ -46,6 +46,12 @@ final class Netmail extends Model implements Packet
|
|||||||
public function __get($key)
|
public function __get($key)
|
||||||
{
|
{
|
||||||
switch ($key) {
|
switch ($key) {
|
||||||
|
case 'get_fftn':
|
||||||
|
return $this->set->get('set_fftn') ?: $this->fftn->ftn;
|
||||||
|
|
||||||
|
case 'get_tftn':
|
||||||
|
return $this->set->get('set_tftn') ?: $this->tftn->ftn;
|
||||||
|
|
||||||
case 'set_fftn':
|
case 'set_fftn':
|
||||||
case 'set_tftn':
|
case 'set_tftn':
|
||||||
case 'set_path':
|
case 'set_path':
|
||||||
|
@ -49,7 +49,7 @@ class NetmailBadAddress extends Netmails
|
|||||||
|
|
||||||
$msg->addText($this->sourceSummary($this->mo)."\r\r");
|
$msg->addText($this->sourceSummary($this->mo)."\r\r");
|
||||||
|
|
||||||
$msg->addText(sprintf("The address in this netmail [%s] is the wrong address for the domain [%s].\r\r",$this->mo->set_fftn,$ao->zone->domain->name));
|
$msg->addText(sprintf("The from [%s] or to [%s] address in this netmail is the wrong address for the domain [%s].\r\r",$this->mo->get_fftn,$this->mo->get_tftn,$ao->zone->domain->name));
|
||||||
|
|
||||||
$msg->addText("This netmail has been rejected and not stored here - so no downstream node will receive it. If you think this is a mistake, please let me know.\r\r");
|
$msg->addText("This netmail has been rejected and not stored here - so no downstream node will receive it. If you think this is a mistake, please let me know.\r\r");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user