summaryrefslogtreecommitdiff
path: root/sshconnect.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2017-04-30 23:13:25 +0000
committerDamien Miller <djm@mindrot.org>2017-05-01 09:42:37 +1000
commit97f4d3083b036ce3e68d6346a6140a22123d5864 (patch)
tree301c95453934721eca9855cd01b1d0da089e3246 /sshconnect.c
parent99f95ba82673d33215dce17bfa1512b57f54ec09 (diff)
upstream commit
remove compat20/compat13/compat15 variables ok markus@ Upstream-ID: 43802c035ceb3fef6c50c400e4ecabf12354691c
Diffstat (limited to 'sshconnect.c')
-rw-r--r--sshconnect.c32
1 files changed, 9 insertions, 23 deletions
diff --git a/sshconnect.c b/sshconnect.c
index d48f2e06c..d01d2c82d 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshconnect.c,v 1.275 2017/04/30 23:11:45 djm Exp $ */ 1/* $OpenBSD: sshconnect.c,v 1.276 2017/04/30 23:13:25 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -524,13 +524,8 @@ static void
524send_client_banner(int connection_out, int minor1) 524send_client_banner(int connection_out, int minor1)
525{ 525{
526 /* Send our own protocol version identification. */ 526 /* Send our own protocol version identification. */
527 if (compat20) { 527 xasprintf(&client_version_string, "SSH-%d.%d-%.100s\r\n",
528 xasprintf(&client_version_string, "SSH-%d.%d-%.100s\r\n", 528 PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION);
529 PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION);
530 } else {
531 xasprintf(&client_version_string, "SSH-%d.%d-%.100s\n",
532 PROTOCOL_MAJOR_1, minor1, SSH_VERSION);
533 }
534 if (atomicio(vwrite, connection_out, client_version_string, 529 if (atomicio(vwrite, connection_out, client_version_string,
535 strlen(client_version_string)) != strlen(client_version_string)) 530 strlen(client_version_string)) != strlen(client_version_string))
536 fatal("write: %.100s", strerror(errno)); 531 fatal("write: %.100s", strerror(errno));
@@ -559,7 +554,6 @@ ssh_exchange_identification(int timeout_ms)
559 fdsetsz = howmany(connection_in + 1, NFDBITS) * sizeof(fd_mask); 554 fdsetsz = howmany(connection_in + 1, NFDBITS) * sizeof(fd_mask);
560 fdset = xcalloc(1, fdsetsz); 555 fdset = xcalloc(1, fdsetsz);
561 556
562 enable_compat20();
563 send_client_banner(connection_out, 0); 557 send_client_banner(connection_out, 0);
564 client_banner_sent = 1; 558 client_banner_sent = 1;
565 559
@@ -628,15 +622,12 @@ ssh_exchange_identification(int timeout_ms)
628 mismatch = 0; 622 mismatch = 0;
629 623
630 switch (remote_major) { 624 switch (remote_major) {
625 case 2:
626 break;
631 case 1: 627 case 1:
632 if (remote_minor == 99) 628 if (remote_minor != 99)
633 enable_compat20();
634 else
635 mismatch = 1; 629 mismatch = 1;
636 break; 630 break;
637 case 2:
638 enable_compat20();
639 break;
640 default: 631 default:
641 mismatch = 1; 632 mismatch = 1;
642 break; 633 break;
@@ -1243,8 +1234,7 @@ verify_host_key(char *host, struct sockaddr *hostaddr, Key *host_key)
1243 host_key->cert->principals[i]); 1234 host_key->cert->principals[i]);
1244 } 1235 }
1245 } else { 1236 } else {
1246 debug("Server host key: %s %s", compat20 ? 1237 debug("Server host key: %s %s", sshkey_ssh_name(host_key), fp);
1247 sshkey_ssh_name(host_key) : sshkey_type(host_key), fp);
1248 } 1238 }
1249 1239
1250 if (sshkey_equal(previous_host_key, host_key)) { 1240 if (sshkey_equal(previous_host_key, host_key)) {
@@ -1349,12 +1339,8 @@ ssh_login(Sensitive *sensitive, const char *orighost,
1349 /* key exchange */ 1339 /* key exchange */
1350 /* authenticate user */ 1340 /* authenticate user */
1351 debug("Authenticating to %s:%d as '%s'", host, port, server_user); 1341 debug("Authenticating to %s:%d as '%s'", host, port, server_user);
1352 if (compat20) { 1342 ssh_kex2(host, hostaddr, port);
1353 ssh_kex2(host, hostaddr, port); 1343 ssh_userauth2(local_user, server_user, host, sensitive);
1354 ssh_userauth2(local_user, server_user, host, sensitive);
1355 } else {
1356 fatal("ssh1 is not supported");
1357 }
1358 free(local_user); 1344 free(local_user);
1359} 1345}
1360 1346