diff --git a/app/Classes/Node.php b/app/Classes/Node.php index ce90e5e..74a4af0 100644 --- a/app/Classes/Node.php +++ b/app/Classes/Node.php @@ -80,7 +80,11 @@ class Node // The nodes password case 'password': - return ($this->ftns->count() && ($x=$this->ftns->first()->session('sespass'))) ? $x : '-'; + // If we have already authed, we'll use that password. + if ($this->ftns_authed->count()) + return $this->ftns_authed->first()->session('sespass'); + else + return ($this->ftns->count() && ($x=$this->ftns->first()->session('sespass'))) ? $x : '-'; // Return how long our session has been connected case 'session_time': diff --git a/app/Classes/Protocol.php b/app/Classes/Protocol.php index fca3007..5d359de 100644 --- a/app/Classes/Protocol.php +++ b/app/Classes/Protocol.php @@ -241,6 +241,7 @@ abstract class Protocol // If we are connecting to a node if ($o->exists) { + Log::debug(sprintf('%s: + Originating a connection to [%s]',self::LOGKEY,$o->ftn)); $this->node->originate($o); } else { @@ -255,17 +256,17 @@ abstract class Protocol switch ($type) { /** @noinspection PhpMissingBreakStatementInspection */ case self::SESSION_AUTO: - Log::debug(sprintf('%s: - Trying EMSI',self::LOGKEY)); + Log::debug(sprintf('%s: - Trying EMSI',self::LOGKEY)); $rc = $this->protocol_init(); if ($rc < 0) { - Log::error(sprintf('%s: ! Unable to start EMSI [%d]',self::LOGKEY,$rc)); + Log::error(sprintf('%s:! Unable to start EMSI [%d]',self::LOGKEY,$rc)); return self::S_REDIAL | self::S_ADDTRY; } case self::SESSION_EMSI: - Log::debug(sprintf('%s: - Starting EMSI',self::LOGKEY)); + Log::debug(sprintf('%s: - Starting EMSI',self::LOGKEY)); $rc = $this->protocol_session(); break; diff --git a/app/Classes/Protocol/EMSI.php b/app/Classes/Protocol/EMSI.php index 9ae2b92..5042100 100644 --- a/app/Classes/Protocol/EMSI.php +++ b/app/Classes/Protocol/EMSI.php @@ -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) { diff --git a/app/Models/Address.php b/app/Models/Address.php index d845927..7c3b0a4 100644 --- a/app/Models/Address.php +++ b/app/Models/Address.php @@ -494,7 +494,7 @@ class Address extends Model public function check_activation(User $uo,string $code): bool { try { - Log::info(sprintf('%s:Checking Activation code [%s] invalid for user [%d]',self::LOGKEY,$code,$uo->id)); + Log::info(sprintf('%s:Checking Activation code [%s] is valid for user [%d]',self::LOGKEY,$code,$uo->id)); return ($code == $this->set_activation($uo));