Allow SSH-1 only if compiled in

This commit is contained in:
Aris Adamantiadis
2011-01-26 22:14:48 +01:00
parent bef014b7a9
commit f6c31db3fc
2 changed files with 9 additions and 0 deletions

View File

@@ -573,8 +573,10 @@ int ssh_connect(ssh_session session) {
/* Here we decide which version of the protocol to use. */ /* Here we decide which version of the protocol to use. */
if (ssh2 && session->ssh2) { if (ssh2 && session->ssh2) {
session->version = 2; session->version = 2;
#ifdef WITH_SSH1
} else if(ssh1 && session->ssh1) { } else if(ssh1 && session->ssh1) {
session->version = 1; session->version = 1;
#endif
} else { } else {
ssh_set_error(session, SSH_FATAL, ssh_set_error(session, SSH_FATAL,
"No version of SSH protocol usable (banner: %s)", "No version of SSH protocol usable (banner: %s)",
@@ -629,6 +631,7 @@ int ssh_connect(ssh_session session) {
session->connected = 1; session->connected = 1;
break; break;
#ifdef WITH_SSH1
case 1: case 1:
if (ssh_get_kex1(session) < 0) { if (ssh_get_kex1(session) < 0) {
ssh_socket_close(session->socket); ssh_socket_close(session->socket);
@@ -640,6 +643,7 @@ int ssh_connect(ssh_session session) {
session->connected = 1; session->connected = 1;
break; break;
#endif
} }
leave_function(); leave_function();

View File

@@ -450,6 +450,8 @@ int verify_existing_algo(int algo, const char *name){
return 0; return 0;
} }
#ifdef WITH_SSH1
/* makes a STRING contating 3 strings : ssh-rsa1,e and n */ /* makes a STRING contating 3 strings : ssh-rsa1,e and n */
/* this is a public key in openssh's format */ /* this is a public key in openssh's format */
static ssh_string make_rsa1_string(ssh_string e, ssh_string n){ 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; return 0;
} }
/* returns 1 if the modulus of k1 is < than the one of k2 */ /* 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){ static int modulus_smaller(ssh_public_key k1, ssh_public_key k2){
bignum n1; bignum n1;
@@ -796,4 +799,6 @@ error:
return rc; return rc;
} }
#endif /* WITH_SSH1 */
/* vim: set ts=2 sw=2 et cindent: */ /* vim: set ts=2 sw=2 et cindent: */