Fix for binkd when remote present binkp protocol in brackets

This commit is contained in:
Deon George 2023-09-18 16:44:14 +10:00
parent cc04ddd7b3
commit eb40f94e37

View File

@ -1076,11 +1076,17 @@ final class Binkp extends BaseProtocol
} elseif (! strncmp($buf,'VER ',4)) { } elseif (! strncmp($buf,'VER ',4)) {
$data = $this->skip_blanks(substr($buf,4)); $data = $this->skip_blanks(substr($buf,4));
$matches = []; $matches = [];
preg_match('#^(.+)\s+binkp/([0-9]+)\.([0-9]+)$#',$data,$matches); preg_match('#^(.+)\s+\(?binkp/([0-9]+)\.([0-9]+)\)?$#',$data,$matches);
if (count($matches) === 4) {
$this->node->software = $matches[1]; $this->node->software = $matches[1];
$this->node->ver_major = $matches[2]; $this->node->ver_major = $matches[2];
$this->node->ver_minor = $matches[3]; $this->node->ver_minor = $matches[3];
} else {
$this->node->software = 'Unknown';
$this->node->ver_major = 0;
$this->node->ver_minor = 0;
}
} elseif (! strncmp($buf,'TRF ',4)) { } elseif (! strncmp($buf,'TRF ',4)) {
$data = $this->skip_blanks(substr($buf,4)); $data = $this->skip_blanks(substr($buf,4));