diff --git a/exec/load/binkp.js b/exec/load/binkp.js index 1fb38c3df8bf6c71e2fd564899f0a5ed53033ca7..247a6ec295eb05c5f2cad0a4182859480514314c 100644 --- a/exec/load/binkp.js +++ b/exec/load/binkp.js @@ -406,8 +406,12 @@ BinkP.prototype.connect = function(addr, password, auth_cb, port, inet_host) return false; } + /* Check if the first remote comand is an M_NUL "OPT TLS" */ + pkt = this.recvFrame(this.timeout); + if (pkt === undefined) + return false; this.authenticated = undefined; - if (password !== '-') + if (password !== '-' && !this.will_tls) this.sendCmd(this.command.M_NUL, "OPT CRYPT"); else { /* @@ -421,10 +425,6 @@ BinkP.prototype.connect = function(addr, password, auth_cb, port, inet_host) this.wont_crypt = true; this.require_crypt = false; } - /* Check if the first remote comand is an M_NUL "OPT TLS" */ - pkt = this.recvFrame(this.timeout); - if (pkt === undefined) - return false; this.sendCmd(this.command.M_NUL, "SYS "+this.system_name); this.sendCmd(this.command.M_NUL, "ZYZ "+this.system_operator); this.sendCmd(this.command.M_NUL, "LOC "+this.system_location);