version 1.275, 2017/04/30 23:11:45 |
version 1.276, 2017/04/30 23:13:25 |
|
|
send_client_banner(int connection_out, int minor1) |
send_client_banner(int connection_out, int minor1) |
{ |
{ |
/* Send our own protocol version identification. */ |
/* Send our own protocol version identification. */ |
if (compat20) { |
xasprintf(&client_version_string, "SSH-%d.%d-%.100s\r\n", |
xasprintf(&client_version_string, "SSH-%d.%d-%.100s\r\n", |
PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION); |
PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION); |
|
} else { |
|
xasprintf(&client_version_string, "SSH-%d.%d-%.100s\n", |
|
PROTOCOL_MAJOR_1, minor1, SSH_VERSION); |
|
} |
|
if (atomicio(vwrite, connection_out, client_version_string, |
if (atomicio(vwrite, connection_out, client_version_string, |
strlen(client_version_string)) != strlen(client_version_string)) |
strlen(client_version_string)) != strlen(client_version_string)) |
fatal("write: %.100s", strerror(errno)); |
fatal("write: %.100s", strerror(errno)); |
|
|
fdsetsz = howmany(connection_in + 1, NFDBITS) * sizeof(fd_mask); |
fdsetsz = howmany(connection_in + 1, NFDBITS) * sizeof(fd_mask); |
fdset = xcalloc(1, fdsetsz); |
fdset = xcalloc(1, fdsetsz); |
|
|
enable_compat20(); |
|
send_client_banner(connection_out, 0); |
send_client_banner(connection_out, 0); |
client_banner_sent = 1; |
client_banner_sent = 1; |
|
|
|
|
mismatch = 0; |
mismatch = 0; |
|
|
switch (remote_major) { |
switch (remote_major) { |
|
case 2: |
|
break; |
case 1: |
case 1: |
if (remote_minor == 99) |
if (remote_minor != 99) |
enable_compat20(); |
|
else |
|
mismatch = 1; |
mismatch = 1; |
break; |
break; |
case 2: |
|
enable_compat20(); |
|
break; |
|
default: |
default: |
mismatch = 1; |
mismatch = 1; |
break; |
break; |
|
|
host_key->cert->principals[i]); |
host_key->cert->principals[i]); |
} |
} |
} else { |
} else { |
debug("Server host key: %s %s", compat20 ? |
debug("Server host key: %s %s", sshkey_ssh_name(host_key), fp); |
sshkey_ssh_name(host_key) : sshkey_type(host_key), fp); |
|
} |
} |
|
|
if (sshkey_equal(previous_host_key, host_key)) { |
if (sshkey_equal(previous_host_key, host_key)) { |
|
|
/* key exchange */ |
/* key exchange */ |
/* authenticate user */ |
/* authenticate user */ |
debug("Authenticating to %s:%d as '%s'", host, port, server_user); |
debug("Authenticating to %s:%d as '%s'", host, port, server_user); |
if (compat20) { |
ssh_kex2(host, hostaddr, port); |
ssh_kex2(host, hostaddr, port); |
ssh_userauth2(local_user, server_user, host, sensitive); |
ssh_userauth2(local_user, server_user, host, sensitive); |
|
} else { |
|
fatal("ssh1 is not supported"); |
|
} |
|
free(local_user); |
free(local_user); |
} |
} |
|
|