From 9d10146af95f330073f9348a67431af3da68a82c Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Sat, 24 Mar 2018 21:09:18 +0000
Subject: [PATCH] Store the remote software version in the BinkP object, don't
 do special stuff in binkp.js, only the protocol.  BinkIT now does the Mystic
 check.

---
 exec/binkit.js     |  2 +-
 exec/load/binkp.js | 11 ++---------
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/exec/binkit.js b/exec/binkit.js
index 554fec18b1..8ea548f7cc 100644
--- a/exec/binkit.js
+++ b/exec/binkit.js
@@ -851,7 +851,7 @@ function inbound_auth_cb(pwd, bp)
 				} else {
 					log(LOG_WARNING, "CRAM-MD5 password mismatch for " + addr 
 						+ format(" (expected: %s, received: %s)", expected, pwd[0]));
-					if (bp.mystic_detected) {
+					if (bp.remote_ver.substr(0, 7) === 'Mystic/') {
 						/*
 						 * MysticBBS v1.12A39 at least has an issue when the CRYPT
 						 * option is included after the CRAM-MD5 challenge.  It appends
diff --git a/exec/load/binkp.js b/exec/load/binkp.js
index e05840e5f6..994c9b00bd 100644
--- a/exec/load/binkp.js
+++ b/exec/load/binkp.js
@@ -93,8 +93,7 @@ function BinkP(name_ver, inbound, rx_callback, tx_callback)
 	this.in_keys = undefined;
 	this.out_keys = undefined;
 	this.capabilities = '115200,TCP,BINKP';
-	this.mystic_bug = false;
-	this.mystic_detected = false;
+	this.remote_ver = undefined;
 
 	this.sent_files = [];
 	this.failed_sent_files = [];
@@ -1164,13 +1163,7 @@ BinkP.prototype.recvFrame = function(timeout)
 							log(LOG_INFO, "Peer version: " + args.slice(1).join(' '));
 							tmp = ret.data.split(/ /);
 							if (tmp.length >= 3) {
-								if (tmp[1].substr(0, 7) === 'Mystic/') {
-									/*
-									 * This allows work-arounds for Mystic binkp
-									 * bugs.  See binkit.js for details.
-									 */
-									this.mystic_detected = true;
-								}
+								this.remote_ver = tmp[1];
 								if (tmp[2].substr(0, 6) === 'binkp/') {
 									ver = tmp[2].substr(6).split(/\./);
 									if (ver.length >= 2) {
-- 
GitLab