From eb40f94e37b26ef9dd1758a42960d0cb57355445 Mon Sep 17 00:00:00 2001 From: Deon George Date: Mon, 18 Sep 2023 16:44:14 +1000 Subject: [PATCH] Fix for binkd when remote present binkp protocol in brackets --- app/Classes/Protocol/Binkp.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/Classes/Protocol/Binkp.php b/app/Classes/Protocol/Binkp.php index 564c161..680f74d 100644 --- a/app/Classes/Protocol/Binkp.php +++ b/app/Classes/Protocol/Binkp.php @@ -1076,11 +1076,17 @@ final class Binkp extends BaseProtocol } elseif (! strncmp($buf,'VER ',4)) { $data = $this->skip_blanks(substr($buf,4)); $matches = []; - preg_match('#^(.+)\s+binkp/([0-9]+)\.([0-9]+)$#',$data,$matches); + preg_match('#^(.+)\s+\(?binkp/([0-9]+)\.([0-9]+)\)?$#',$data,$matches); - $this->node->software = $matches[1]; - $this->node->ver_major = $matches[2]; - $this->node->ver_minor = $matches[3]; + if (count($matches) === 4) { + $this->node->software = $matches[1]; + $this->node->ver_major = $matches[2]; + $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)) { $data = $this->skip_blanks(substr($buf,4));