aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2011-01-26 22:14:48 +0100
committerAris Adamantiadis <aris@0xbadc0de.be>2011-01-26 22:14:48 +0100
commitf6c31db3fc7dcf6000ff57f00dba289acfb99dd3 (patch)
treee5a12464fc8192227776576987d1776ab3ae1c5e
parentbef014b7a938b26b0789252686dcf77ac79f0da7 (diff)
downloadlibssh-f6c31db3fc7dcf6000ff57f00dba289acfb99dd3.tar.gz
libssh-f6c31db3fc7dcf6000ff57f00dba289acfb99dd3.tar.xz
libssh-f6c31db3fc7dcf6000ff57f00dba289acfb99dd3.zip
Allow SSH-1 only if compiled in
-rw-r--r--libssh/client.c4
-rw-r--r--libssh/kex.c5
2 files changed, 9 insertions, 0 deletions
diff --git a/libssh/client.c b/libssh/client.c
index d85f4b39..ecf55327 100644
--- a/libssh/client.c
+++ b/libssh/client.c
@@ -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();
diff --git a/libssh/kex.c b/libssh/kex.c
index a219afce..f9da9c23 100644
--- a/libssh/kex.c
+++ b/libssh/kex.c
@@ -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: */