Skip to content
Snippets Groups Projects
Commit b846192f authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Just parse VER using /^VER (.*) ([^ ]*?)$/

This restores the meaning of remote_ver and still has a hack for
broken, unfixable mailers that don't advertise protocol v1.1
correctly (ie: Irex)
parent 10d7a690
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
......@@ -1022,6 +1022,8 @@ BinkP.prototype.recvFrame = function(timeout)
var avail;
var nullpos;
var buf;
var m;
var binkp_ver;
// Avoid warning from syncjslint by putting this in a closure.
function hex2ascii(hex)
......@@ -1208,11 +1210,11 @@ BinkP.prototype.recvFrame = function(timeout)
}
break;
case 'VER':
this.remote_ver = args.slice(1).join(' ');
m = ret.data.match(/^VER (.*) ([^ ]*?)$/);
if (m !== null) {
this.remote_ver = m[1];
log(LOG_INFO, "Peer version: " + this.remote_ver);
var binkp_ver = this.remote_ver.indexOf('binkp/');
if(binkp_ver >= 0) {
binkp_ver = parseFloat(this.remote_ver.substr(binkp_ver + 6));
binkp_ver = parseFloat(m[2].substr(m[2].indexOf('binkp/') + 6));
log(LOG_DEBUG, "Parsed BinkP version: " + binkp_ver);
this.ver_1_1 = binkp_ver >= 1.1;
}
......
  • Owner

    Out of curiosity, I looked up how BinkD does the protocol version parsing:

    #define PRTCLNAME "binkp"
    ...
      if (!memcmp (s, "VER ", 4) &&
          (a = strstr (s, PRTCLNAME "/")) != 0 &&
          (b = strstr (a, ".")) != 0)
      {
        state->major = atoi (a + 6);
        state->minor = atoi (b + 1);
        Log (6, "remote uses " PRTCLNAME " v.%i.%i", state->major, state->minor);

    So... that would match "binkp/1.1" anywhere in the VER string (even in parenthesis), likely explaining why IRex never had a problem with BinkD in this regard.

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment