Fix authentication for originating EMSI session with known systems
This commit is contained in:
parent
0aad25c831
commit
d949737608
@ -80,6 +80,10 @@ 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()->session('sespass');
|
||||
else
|
||||
return ($this->ftns->count() && ($x=$this->ftns->first()->session('sespass'))) ? $x : '-';
|
||||
|
||||
// Return how long our session has been connected
|
||||
|
@ -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 {
|
||||
@ -259,7 +260,7 @@ abstract class Protocol
|
||||
|
||||
$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;
|
||||
}
|
||||
|
@ -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,7 +668,7 @@ 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));
|
||||
/* Step 1
|
||||
@ -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) {
|
||||
|
@ -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));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user