Recognise all AKAs for a system when we are polling it with one of it's AKAs in a domain

This commit is contained in:
Deon George 2024-06-26 16:03:58 +10:00
parent 91d4cd0b2f
commit 7c23971e58

View File

@ -38,6 +38,7 @@ class Node
private Collection $ftns_authed; // The FTNs we have validated
private Collection $ftns_other; // Other FTN addresses presented
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
@ -84,9 +85,9 @@ class Node
// The nodes password
case 'password':
// If we have already authed, we'll use that password.
if ($this->ftns_authed->count())
return $this->ftns_authed->first()->pass_session;
// If we are originating a session, we'll use that password.
if (isset($this->originate))
return $this->originate->pass_session;
else
return ($this->ftns->count() && ($x=$this->ftns->first()->pass_session)) ? $x : '-';
@ -194,6 +195,8 @@ class Node
throw new Exception('Already authed');
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)
continue;
@ -269,7 +272,8 @@ class Node
*/
public function originate(Address $o): void
{
$this->ftns_authed->push($o);
$this->originate = $o;
$this->ftns_authed = $o->system->match($o->zone);
}
/**
@ -283,19 +287,9 @@ class Node
if ($this->authed)
return TRUE;
if ($this->ftns_authed->count() !== 1 || ! $this->ftns->count())
return FALSE;
Log::debug(sprintf('%s:- Making sure we called [%s] from [%s]',self::LOGKEY,$this->originate->ftn,$this->ftns->pluck('ftn')->join(',')));
$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;
return $this->ftns->pluck('ftn')->contains($this->originate->ftn);
}
public function optionClear(int $key): void