Compare commits

..

No commits in common. "dc212d35fb97cf78904657bba63ac91ad42b2a15" and "b398163cfdcb7a2485416577757fa7636c5f22dd" have entirely different histories.

3 changed files with 21 additions and 58 deletions

View File

@ -667,30 +667,24 @@ class Message extends FTNBase
$ptr_end = strpos($message,"\r",$ptr_start);
$m = [];
$kludge = ($x=substr($message,$ptr_start+1,$ptr_end-$ptr_start-1));
$kludge = substr($message,$ptr_start+1,$ptr_end-$ptr_start-1);
preg_match('/^([^\s]+:?)+\s+(.*)$/',$kludge,$m);
$ptr_start = $ptr_end+1;
if (! $m) {
Log::alert(sprintf('%s:! Invalid Kluge Line [%s]',self::LOGKEY,$x));
continue;
}
// Catch any kludges we need to process here
if (array_key_exists($m[1],self::kludges))
$this->{self::kludges[$m[1]]} = $m[2];
else
$o->kludges = [$m[1],$m[2]];
$ptr_start = $ptr_end+1;
}
// Next our message content ends with '\r * Origin: ... \r' or <soh>...
// FTS-0004.001
if ($ptr_end=strrpos($message,"\r * Origin: ",$ptr_start)) {
if ($ptr_end=strpos($message,"\r * Origin: ",$ptr_start)) {
// Find the <cr>
$ptr_end = strpos($message,"\r",$ptr_end+1);
// If there is no ptr_end, then this is not an origin
if (! $ptr_end)
throw new InvalidPacketException('Couldnt find the end of the origin');
@ -698,16 +692,6 @@ class Message extends FTNBase
throw new InvalidPacketException('Couldnt parse the end of the content');
}
$remaining = substr($message,$ptr_end+1);
// At this point, the remaining part of the message should start with \x01, PATH or SEEN-BY
if ((substr($remaining,0,9) !== 'SEEN-BY: ') && (substr($remaining,0,5) !== 'PATH:') && ($x=strpos($remaining,"\x01")) !== 0) {
if ($x)
$ptr_end += $x;
else
$ptr_end += strlen($remaining);
}
// Process the message content
if ($content=substr($message,$ptr_start,$ptr_end-$ptr_start)) {
$o->msg_src = $content;
@ -715,70 +699,57 @@ class Message extends FTNBase
$ptr_content_start = 0;
// See if we have a tagline
if ($ptr_content_end=strrpos($content,"\r\r... ",$ptr_content_start)) {
if ($ptr_content_end=strpos($content,"\r\r... ",$ptr_content_start)) {
$o->msg = substr($content,$ptr_content_start,$ptr_content_end);
$ptr_content_start = $ptr_content_end+6;
$ptr_content_end = strpos($content,"\r",$ptr_content_start);
// If there is no terminating "\r", then that's it
if (! $ptr_content_end) {
if (! $ptr_content_end)
$o->set_tagline = substr($content,$ptr_content_start);
$ptr_content_start = strlen($content);
} else {
else
$o->set_tagline = substr($content,$ptr_content_start,$ptr_content_end-$ptr_content_start);
$ptr_content_start = $ptr_content_end;
}
$ptr_content_start = $ptr_content_end;
}
// See if we have a tearline
if ($ptr_content_end=strrpos($content,"\r\r--- ",$ptr_content_start)) {
if ($ptr_content_end=strpos($content,"\r\r--- ",$ptr_content_start)) {
if (! $ptr_content_start)
$o->msg = substr($content,$ptr_content_start,$ptr_content_end);
$o->msg = substr($content,$ptr_content_start,$ptr_content_end-1);
$ptr_content_start = $ptr_content_end+6;
$ptr_content_end = strpos($content,"\r",$ptr_content_start);
// If there is no terminating "\r", then that's it
if (! $ptr_content_end) {
if (! $ptr_content_end)
$o->set_tearline = substr($content,$ptr_content_start);
$ptr_content_start = strlen($content);
} else {
else
$o->set_tearline = substr($content,$ptr_content_start,$ptr_content_end-$ptr_content_start);
$ptr_content_start = $ptr_content_end;
}
$ptr_content_start = $ptr_content_end;
}
// See if we have an origin
if ($ptr_content_end=strrpos($content,"\r * Origin: ",$ptr_content_start)) {
if ($ptr_content_end=strpos($content,"\r * Origin: ",$ptr_content_start)) {
if (! $ptr_content_start)
$o->msg = substr($content,$ptr_content_start,$ptr_content_end);
$o->msg = substr($content,$ptr_content_start,$ptr_content_end-1);
$ptr_content_start = $ptr_content_end+12;
$ptr_content_end = strpos($content,"\r",$ptr_content_start);
// If there is no terminating "\r", then that's it
if (! $ptr_content_end) {
if (! $ptr_content_end)
$o->set_origin = substr($content,$ptr_content_start);
$ptr_content_start = strlen($content);
} else {
else
$o->set_origin = substr($content,$ptr_content_start,$ptr_content_end-$ptr_content_start);
$ptr_content_start = $ptr_content_end+1;
}
}
// If there wasnt any tagline/tearline/origin, then the whole content is the message
if (! $ptr_content_start) {
$o->msg = $content;
$ptr_content_start = $ptr_end-$ptr_start;
$ptr_content_start = $ptr_content_end;
}
// Quick validation that we are done
if ($ptr_content_start !== strlen($content))
if ($ptr_content_start)
throw new InvalidPacketException('There is more data in the message content?');
}

View File

@ -699,14 +699,10 @@ final class Binkp extends BaseProtocol
// If we only present limited AKAs dont validate password against akas outside of the domains we present
} elseif (is_null(our_address($o))) {
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;
continue;
} elseif (! $o->active) {
Log::alert(sprintf('%s:/ AKA is not active [%s] - ignoring',self::LOGKEY,$rem_aka));
$this->node->ftn_other = $rem_aka;
continue;
} else {

View File

@ -328,14 +328,10 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
// If we only present limited AKAs dont validate password against akas outside of the domains we present
} elseif (is_null(our_address($o))) {
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;
continue;
} elseif (! $o->active) {
Log::alert(sprintf('%s:/ AKA is not active [%s] - ignoring',self::LOGKEY,$rem_aka));
$this->node->ftn_other = $rem_aka;
continue;
} else {