Fix packet processing issue - we now find recent deleted address when creatingFTN, fix netmail processing with points, fix processing badly address netmails
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 35s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m52s
Create Docker Image / Final Docker Image Manifest (push) Successful in 9s

This commit is contained in:
2024-07-11 23:33:17 +10:00
parent e10ca8f18a
commit 62a9139d14
10 changed files with 110 additions and 25 deletions

View File

@@ -17,7 +17,7 @@ abstract class FTN
$this->fn,
$this->ff,
$this->fp,
).($this->zone ? sprintf('@%s',$this->zone->domain->name) : '');
).((isset($this->zone) && $this->zone) ? sprintf('@%s',$this->zone->domain->name) : '');
case 'tftn_t':
return sprintf('%d:%d/%d.%d',
@@ -25,7 +25,7 @@ abstract class FTN
$this->tn,
$this->tf,
$this->tp,
).($this->zone ? sprintf('@%s',$this->zone->domain->name) : '');
).((isset($this->zone) && $this->zone) ? sprintf('@%s',$this->zone->domain->name) : '');
case 'fftn':
return Address::findFTN($this->fftn_t);

View File

@@ -306,7 +306,7 @@ class Message extends FTNBase
case 'fz': return (int)Arr::get($this->src,'z');
case 'fn': return (int)($x=$this->src) ? Arr::get($x,'n') : Arr::get($this->header,'onet');
case 'ff': return (int)($x=$this->src) ? Arr::get($x,'f') : Arr::get($this->header,'onode');
case 'fp': return (int)$this->mo->kludges->get('FMPT:') ?: Arr::get($this->src,'p',Arr::get($this->header,'opoint',0));
case 'fp': return (int)$this->mo->kludges->get('FMPT') ?: Arr::get($this->src,'p',Arr::get($this->header,'opoint',0));
case 'fd': return Arr::get($this->src,'d');
case 'fzone':
@@ -323,6 +323,7 @@ class Message extends FTNBase
return Zone::where('zone_id',$this->fz)
->where('default',TRUE)
->single();
case 'fdomain':
// We'll use the zone's domain if this method class was called with a zone
if ($this->zone && (($this->zone->domain->name === Arr::get($this->src,'d')) || ! Arr::get($this->src,'d')))
@@ -340,7 +341,7 @@ class Message extends FTNBase
case 'tz': return (int)Arr::get($this->isEchomail() ? $this->src : $this->dst,'z');
case 'tn': return (int)Arr::get($this->header,'dnet');
case 'tf': return (int)Arr::get($this->header,'dnode');
case 'tp': return (int)$this->mo->kludges->get('TOPT:') ?: Arr::get($this->header,'dpoint',0);
case 'tp': return (int)$this->mo->kludges->get('TOPT') ?: Arr::get($this->header,'dpoint',0);
case 'tzone':
// Use the zone if this class was called with it.

View File

@@ -3,7 +3,6 @@
namespace App\Classes\FTN;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
@@ -13,7 +12,7 @@ use Symfony\Component\HttpFoundation\File\File;
use App\Classes\FTN as FTNBase;
use App\Exceptions\InvalidPacketException;
use App\Models\{Address,Domain,Echomail,Netmail,Software,System,Zone};
use App\Notifications\Netmails\EchomailBadAddress;
use App\Notifications\Netmails\{EchomailBadAddress,NetmailBadAddress};
/**
* Represents a Fidonet Packet, that contains an array of messages.
@@ -139,7 +138,7 @@ abstract class Packet extends FTNBase implements \Iterator, \Countable
} else
throw new InvalidPacketException('Not a valid packet, not EOP or SOM:'.bin2hex($x));
Log::info(sprintf('%s:- Packet [%s] is a [%s] packet, dated [%s]',self::LOGKEY,$o->name,get_class($o),$o->date));
Log::info(sprintf('%s:- Packet [%s] is a [%s] packet',self::LOGKEY,$o->name,get_class($o)));
// Work out the packet zone
if ($o->fz && ($o->fd || $domain)) {
@@ -159,6 +158,8 @@ abstract class Packet extends FTNBase implements \Iterator, \Countable
->singleOrFail();
}
Log::info(sprintf('%s:- Packet Dated [%s] from [%s] to [%s]',self::LOGKEY,$o->date,$o->fftn_t,$o->tftn_t));
$message = ''; // Current message we are building
$msgbuf = '';
$leader = Message::header_len()+strlen(self::PACKED_MSG_LEAD);
@@ -384,10 +385,11 @@ abstract class Packet extends FTNBase implements \Iterator, \Countable
// If the messages is not for the right zone, we'll ignore it
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->fftn->zone->zone_id,$this->fftn->zone->zone_id));
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));
// @todo $msg might not be echomail
if (! $msg->kludges->get('RESCANNED'))
Notification::route('netmail',$this->fftn)->notify(new EchomailBadAddress($msg));
Notification::route('netmail',$this->fftn)->notify(($msg instanceof Echomail) ? new EchomailBadAddress($msg) : new NetmailBadAddress($msg));
return;
}
@@ -396,7 +398,7 @@ abstract class Packet extends FTNBase implements \Iterator, \Countable
if ($msg->errors->has('from') && $this->fftn && $this->fftn->zone_id) {
Log::debug(sprintf('%s:^ From address [%s] doesnt exist, it needs to be created',self::LOGKEY,$msg->set->get('set_fftn')));
$ao = Address::findFTN($msg->set->get('set_fftn'),TRUE);
$ao = Address::findFTN($msg->set->get('set_fftn'),TRUE,TRUE);
if ($ao?->exists && ($ao->zone?->domain_id !== $this->fftn->zone->domain_id)) {
Log::alert(sprintf('%s:! From address [%s] domain [%d] doesnt match packet domain [%d]?',self::LOGKEY,$msg->set->get('set_fftn'),$ao->zone?->domain_id,$this->fftn->zone->domain_id));
@@ -407,17 +409,20 @@ abstract class Packet extends FTNBase implements \Iterator, \Countable
if (! $ao) {
$so = System::createUnknownSystem();
$ao = Address::createFTN($msg->set->get('set_fftn'),$so);
Log::alert(sprintf('%s:- From FTN [%s] is not defined, created new entry for (%d)',self::LOGKEY,$msg->set->get('set_fftn'),$ao->id));
}
$msg->fftn_id = $ao->id;
Log::alert(sprintf('%s:- From FTN [%s] is not defined, created new entry for (%d)',self::LOGKEY,$msg->set->get('set_fftn'),$ao->id));
$msg->errors->forget('from');
$msg->errors->forget('fftn_id');
}
// If the $msg->tftn doesnt exist, we'll need to create it
if ($msg->errors->has('to') && $this->tftn && $this->tftn->zone_id) {
Log::debug(sprintf('%s:^ To address [%s] doesnt exist, it needs to be created',self::LOGKEY,$msg->set->get('set_tftn')));
$ao = Address::findFTN($msg->set->get('set_tftn'),TRUE);
$ao = Address::findFTN($msg->set->get('set_tftn'),TRUE,TRUE);
if ($ao?->exists && ($ao->zone?->domain_id !== $this->tftn->zone->domain_id)) {
Log::alert(sprintf('%s:! To address [%s] domain [%d] doesnt match packet domain [%d]?',self::LOGKEY,$msg->set->get('set_tftn'),$ao->zone?->domain_id,$this->fftn->zone->domain_id));
@@ -428,10 +433,13 @@ abstract class Packet extends FTNBase implements \Iterator, \Countable
if (! $ao) {
$so = System::createUnknownSystem();
$ao = Address::createFTN($msg->set->get('set_fftn'),$so);
Log::alert(sprintf('%s:- To FTN [%s] is not defined, created new entry for (%d)',self::LOGKEY,$msg->set->get('set_tftn'),$ao->id));
}
$msg->tftn_id = $ao->id;
Log::alert(sprintf('%s:- To FTN [%s] is not defined, created new entry for (%d)',self::LOGKEY,$msg->set->get('set_tftn'),$ao->id));
$msg->errors->forget('to');
$msg->errors->forget('tftn_id');
}
// If there is no fftn, then its from a system that we dont know about