Fix authentication for originating EMSI session with known systems

This commit is contained in:
Deon George
2023-02-11 23:06:13 +11:00
parent 0aad25c831
commit d949737608
4 changed files with 19 additions and 12 deletions

View File

@@ -190,7 +190,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
// Site address, password and compatibility
$makedata .= sprintf('{EMSI}{%s}{%s}{%s}{%s}',
$this->our_addresses()->pluck('ftn')->join(' '),
$this->node->password == '-' ? '' : $this->node->password,
($this->node->password == '-') ? '' : $this->node->password,
join(',',$link_codes),
join(',',$compat_codes),
);
@@ -668,9 +668,9 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
*/
private function emsi_send(): int
{
Log::debug(sprintf('%s:+ emsi_send',self::LOGKEY));
Log::debug(sprintf('%s:+ EMSI send',self::LOGKEY));
Log::debug(sprintf('%s: - STEP 1',self::LOGKEY));
Log::debug(sprintf('%s: - STEP 1',self::LOGKEY));
/* Step 1
+-+------------------------------------------------------------------+
:1: Tries=0, T1=60 seconds :
@@ -682,7 +682,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
$t1 = $this->client->timer_set(self::EMSI_HSTIMEOUT);
step2:
Log::debug(sprintf('%s: - STEP 2',self::LOGKEY));
Log::debug(sprintf('%s: - STEP 2',self::LOGKEY));
/* Step 2
+-+------------------------------------------------------------------+
:2: Transmit EMSI_DAT packet and increment Tries :
@@ -723,7 +723,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
+-+------------------------------------------------------------------+
*/
Log::debug(sprintf('%s: - STEP 4',self::LOGKEY));
while(! $this->client->timer_expired($t1)) {
while (! $this->client->timer_expired($t1)) {
$ch = $this->client->read_ch(max( 1,min($this->client->timer_rest($t1),$this->client->timer_rest($t2))));
// Log::debug(sprintf('%s: - Got (%x) {%03d} (%c)',__METHOD__,$ch,$ch,$ch));
@@ -754,7 +754,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
$t2 = $this->client->timer_set($this->client->timer_rest($t2) >> 2);
} else if (! strncmp($p,self::EMSI_REQ,self::EMSI_SEQ_LEN)) {
Log::notice(sprintf('%s: - Got EMSI_REQ - skipping...',self::LOGKEY));
Log::notice(sprintf('%s: - Got EMSI_REQ - skipping...',self::LOGKEY),['p'=>$p]);
} else if (! strncmp($p,self::EMSI_ACK,self::EMSI_SEQ_LEN)) {
Log::debug(sprintf('%s: - Got EMSI_ACK',self::LOGKEY));
@@ -951,13 +951,14 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
*/
protected function protocol_session(): int
{
Log::debug(sprintf('%s:+ protocol_session',self::LOGKEY));
Log::debug(sprintf('%s:+ Starting EMSI Protocol Session',self::LOGKEY));
$was_req = 0;
$got_req = 0;
// Outbound session
if ($this->originate) {
Log::debug(sprintf('%s: - Outbound session',self::LOGKEY));
$this->optionSet(self::O_PUA);
//$emsi_lo |= ($this->is_freq_available() <= self::FR_NOTAVAILABLE ) ? self::O_NRQ : $emsi_lo;
@@ -973,6 +974,7 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
// Inbound session
} else {
Log::debug(sprintf('%s: - Inbound session',self::LOGKEY));
$rc = $this->emsi_recv(self::SM_INBOUND);
if ($rc < 0) {