|
|
@@ -3148,15 +3148,21 @@ static int do_ssh_init(Ssh ssh, unsigned char c)
|
|
|
/* Anything greater or equal to "1.99" means protocol 2 is supported. */
|
|
|
s->proto2 = ssh_versioncmp(s->version, "1.99") >= 0;
|
|
|
|
|
|
- if (conf_get_int(ssh->conf, CONF_sshprot) == 0 && !s->proto1) {
|
|
|
- bombout(("SSH protocol version 1 required by configuration but "
|
|
|
- "not provided by server"));
|
|
|
- crStop(0);
|
|
|
- }
|
|
|
- if (conf_get_int(ssh->conf, CONF_sshprot) == 3 && !s->proto2) {
|
|
|
- bombout(("SSH protocol version 2 required by configuration but "
|
|
|
- "not provided by server"));
|
|
|
- crStop(0);
|
|
|
+ if (conf_get_int(ssh->conf, CONF_sshprot) == 0) {
|
|
|
+ if (!s->proto1) {
|
|
|
+ bombout(("SSH protocol version 1 required by our configuration "
|
|
|
+ "but not provided by server"));
|
|
|
+ crStop(0);
|
|
|
+ }
|
|
|
+ } else if (conf_get_int(ssh->conf, CONF_sshprot) == 3) {
|
|
|
+ if (!s->proto2) {
|
|
|
+ bombout(("SSH protocol version 2 required by our configuration "
|
|
|
+ "but server only provides (old, insecure) SSH-1"));
|
|
|
+ crStop(0);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ /* No longer support values 1 or 2 for CONF_sshprot */
|
|
|
+ assert(!"Unexpected value for CONF_sshprot");
|
|
|
}
|
|
|
|
|
|
if (s->proto2 && (conf_get_int(ssh->conf, CONF_sshprot) >= 2 || !s->proto1))
|
|
|
@@ -3725,13 +3731,17 @@ static const char *connect_to_host(Ssh ssh, const char *host, int port,
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
- * If the SSH version number's fixed, set it now, and if it's SSH-2,
|
|
|
- * send the version string too.
|
|
|
+ * The SSH version number is always fixed (since we no longer support
|
|
|
+ * fallback between versions), so set it now, and if it's SSH-2,
|
|
|
+ * send the version string now too.
|
|
|
*/
|
|
|
sshprot = conf_get_int(ssh->conf, CONF_sshprot);
|
|
|
+ assert(sshprot == 0 || sshprot == 3);
|
|
|
if (sshprot == 0)
|
|
|
+ /* SSH-1 only */
|
|
|
ssh->version = 1;
|
|
|
if (sshprot == 3 && !ssh->bare_connection) {
|
|
|
+ /* SSH-2 only */
|
|
|
ssh->version = 2;
|
|
|
ssh_send_verstring(ssh, "SSH-", NULL);
|
|
|
}
|