mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-05 04:40:31 +09:00
Allow SSH-1 only if compiled in
This commit is contained in:
@@ -573,8 +573,10 @@ int ssh_connect(ssh_session session) {
|
||||
/* Here we decide which version of the protocol to use. */
|
||||
if (ssh2 && session->ssh2) {
|
||||
session->version = 2;
|
||||
#ifdef WITH_SSH1
|
||||
} else if(ssh1 && session->ssh1) {
|
||||
session->version = 1;
|
||||
#endif
|
||||
} else {
|
||||
ssh_set_error(session, SSH_FATAL,
|
||||
"No version of SSH protocol usable (banner: %s)",
|
||||
@@ -629,6 +631,7 @@ int ssh_connect(ssh_session session) {
|
||||
|
||||
session->connected = 1;
|
||||
break;
|
||||
#ifdef WITH_SSH1
|
||||
case 1:
|
||||
if (ssh_get_kex1(session) < 0) {
|
||||
ssh_socket_close(session->socket);
|
||||
@@ -640,6 +643,7 @@ int ssh_connect(ssh_session session) {
|
||||
|
||||
session->connected = 1;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
leave_function();
|
||||
|
||||
@@ -450,6 +450,8 @@ int verify_existing_algo(int algo, const char *name){
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef WITH_SSH1
|
||||
|
||||
/* makes a STRING contating 3 strings : ssh-rsa1,e and n */
|
||||
/* this is a public key in openssh's format */
|
||||
static ssh_string make_rsa1_string(ssh_string e, ssh_string n){
|
||||
@@ -507,6 +509,7 @@ static int build_session_id1(ssh_session session, ssh_string servern,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* returns 1 if the modulus of k1 is < than the one of k2 */
|
||||
static int modulus_smaller(ssh_public_key k1, ssh_public_key k2){
|
||||
bignum n1;
|
||||
@@ -796,4 +799,6 @@ error:
|
||||
return rc;
|
||||
}
|
||||
|
||||
#endif /* WITH_SSH1 */
|
||||
|
||||
/* vim: set ts=2 sw=2 et cindent: */
|
||||
|
||||
Reference in New Issue
Block a user