Compare commits

..

No commits in common. "d3a9e36bb7b2a0e3c3b9ffbf7b88a577eaf90688" and "db8475053c08c1b7f20349cf294831b99e916f67" have entirely different histories.

5 changed files with 34 additions and 23 deletions

View File

@ -38,7 +38,6 @@ class Node
private Collection $ftns_authed; // The FTNs we have validated private Collection $ftns_authed; // The FTNs we have validated
private Collection $ftns_other; // Other FTN addresses presented private Collection $ftns_other; // Other FTN addresses presented
private bool $authed; // Have we authenticated the remote. private bool $authed; // Have we authenticated the remote.
private Address $originate; // When we originate a call, this is who we are after
private int $options; // This nodes capabilities/options private int $options; // This nodes capabilities/options
@ -85,9 +84,9 @@ class Node
// The nodes password // The nodes password
case 'password': case 'password':
// If we are originating a session, we'll use that password. // If we have already authed, we'll use that password.
if (isset($this->originate)) if ($this->ftns_authed->count())
return $this->originate->pass_session; return $this->ftns_authed->first()->pass_session;
else else
return ($this->ftns->count() && ($x=$this->ftns->first()->pass_session)) ? $x : '-'; return ($this->ftns->count() && ($x=$this->ftns->first()->pass_session)) ? $x : '-';
@ -195,8 +194,6 @@ class Node
throw new Exception('Already authed'); throw new Exception('Already authed');
foreach ($this->ftns as $o) { foreach ($this->ftns as $o) {
Log::debug(sprintf('%s:- Attempting to authenticate [%s] with [%s]',self::LOGKEY,$o->ftn,$o->pass_session));
if (! $sespass=$o->pass_session) if (! $sespass=$o->pass_session)
continue; continue;
@ -272,8 +269,7 @@ class Node
*/ */
public function originate(Address $o): void public function originate(Address $o): void
{ {
$this->originate = $o; $this->ftns_authed->push($o);
$this->ftns_authed = $o->system->match($o->zone);
} }
/** /**
@ -287,9 +283,19 @@ class Node
if ($this->authed) if ($this->authed)
return TRUE; return TRUE;
Log::debug(sprintf('%s:- Making sure we called [%s] from [%s]',self::LOGKEY,$this->originate->ftn,$this->ftns->pluck('ftn')->join(','))); if ($this->ftns_authed->count() !== 1 || ! $this->ftns->count())
return FALSE;
return $this->ftns->pluck('ftn')->contains($this->originate->ftn); $ftn = $this->ftns_authed->first()->ftn;
return $this->ftns->search(function($item) use ($ftn) {
if ($item->ftn === $ftn) {
$item->system->last_session = Carbon::now();
$item->system->save();
$this->authed = TRUE;
return TRUE;
}
}) !== FALSE;
} }
public function optionClear(int $key): void public function optionClear(int $key): void

View File

@ -711,7 +711,7 @@ final class Binkp extends BaseProtocol
// If we only present limited AKAs dont validate password against akas outside of the domains we present // If we only present limited AKAs dont validate password against akas outside of the domains we present
} elseif (is_null(our_address($o))) { } elseif (is_null(our_address($o))) {
Log::debug(sprintf('%s:/ AKA domain [%s] is not in our domain(s) [%s] - ignoring',self::LOGKEY,$o->zone->domain->name,our_address()->pluck('zone.domain.name')->unique()->join(','))); Log::alert(sprintf('%s:/ AKA domain [%s] is not in our domain(s) [%s] - ignoring',self::LOGKEY,$o->zone->domain->name,our_address()->pluck('zone.domain.name')->unique()->join(',')));
$this->node->ftn_other = $rem_aka; $this->node->ftn_other = $rem_aka;
continue; continue;

View File

@ -48,6 +48,21 @@ class MailSend #implements ShouldQueue
->join('systems',['systems.id'=>'a.system_id']) ->join('systems',['systems.id'=>'a.system_id'])
->join('zones',['zones.id'=>'a.zone_id']) ->join('zones',['zones.id'=>'a.zone_id'])
->join('domains',['domains.id'=>'zones.domain_id']) ->join('domains',['domains.id'=>'zones.domain_id'])
->where(function($query) {
return $query->whereNull('autohold')
->orWhere('autohold',FALSE);
})
->when(! is_null($this->crash),function($query) {
return $query->when(
$this->crash,
function($query) {
return $query->where('pollmode',$this->crash);
},
function($query) {
return $query->whereNotNull('pollmode');
}
);
})
->groupBy('a.system_id','a.id','a.zone_id','addresses.region_id','a.host_id','a.node_id','a.point_id','addresses.hub_id','addresses.role') ->groupBy('a.system_id','a.id','a.zone_id','addresses.region_id','a.host_id','a.node_id','a.point_id','addresses.hub_id','addresses.role')
->with(['system','zone.domain']) ->with(['system','zone.domain'])
->dontCache() ->dontCache()
@ -65,13 +80,6 @@ class MailSend #implements ShouldQueue
} else { } else {
return $item; return $item;
} }
})
->filter(function($item) {
if ($item->ftn3d === '1337:1/100') dump(['item'=>$item,'ftn'=>$item->ftn,'autohold'=>$item->system->authold,'pollmode'=>$item->system->pollmode,'crash'=>$this->crash]);
if ($item->system->autohold)
return NULL;
return is_null($this->crash) || ($item->system->pollmode) || ($item->system->pollmode === $this->crash) ? $item : NULL;
}); });
foreach ($u->groupBy('ftn') as $oo) { foreach ($u->groupBy('ftn') as $oo) {

View File

@ -51,7 +51,6 @@ abstract class Netmails extends Notification //implements ShouldQueue
{ {
// @todo Redirect netmails to Hubs or higher to the admin // @todo Redirect netmails to Hubs or higher to the admin
$ao = $notifiable->routeNotificationFor(static::via); $ao = $notifiable->routeNotificationFor(static::via);
$ao->load('system');
$o = new Netmail; $o = new Netmail;
$o->to = $ao->system->sysop; $o->to = $ao->system->sysop;

View File

@ -6,9 +6,9 @@
namespace App\Traits; namespace App\Traits;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Log;
use App\Classes\FTN\Message; use App\Classes\FTN\Message;
use App\Models\Setup;
trait MsgID trait MsgID
{ {
@ -18,8 +18,6 @@ trait MsgID
if ((! $this->exists) && ($this->flags & Message::FLAG_LOCAL) && (is_null(Arr::get($this->attributes,'msgid')))) { if ((! $this->exists) && ($this->flags & Message::FLAG_LOCAL) && (is_null(Arr::get($this->attributes,'msgid')))) {
$ftn = our_address($this->fftn); $ftn = our_address($this->fftn);
$this->attributes['msgid'] = sprintf('%s %08x',$ftn->ftn4d,timew()); $this->attributes['msgid'] = sprintf('%s %08x',$ftn->ftn4d,timew());
Log::debug(sprintf('%s:- Auto setting msgid to [%s]',self::LOGKEY,$this->attributes['msgid']));
} }
return parent::save($options); return parent::save($options);