summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Gasser <gasser@in.tum.de>2012-06-21 19:06:47 +0200
committerAndreas Schneider <asn@cryptomilk.org>2012-07-06 11:04:05 +0200
commitad24427f038221e5276903ab599359e495127b16 (patch)
treee5584bc123edc9a0213ca5710597d9d3fb8b71b8
parent2ed9d2160d126c76ab784da54b642b8930156dc5 (diff)
downloadlibssh-ad24427f038221e5276903ab599359e495127b16.tar.gz
libssh-ad24427f038221e5276903ab599359e495127b16.tar.xz
libssh-ad24427f038221e5276903ab599359e495127b16.zip
options: Add option to specify host keys string.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--include/libssh/libssh.h3
-rw-r--r--src/options.c15
2 files changed, 17 insertions, 1 deletions
diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h
index f22ce71..0167b4a 100644
--- a/include/libssh/libssh.h
+++ b/include/libssh/libssh.h
@@ -324,7 +324,8 @@ enum ssh_options_e {
SSH_OPTIONS_STRICTHOSTKEYCHECK,
SSH_OPTIONS_COMPRESSION,
SSH_OPTIONS_COMPRESSION_LEVEL,
- SSH_OPTIONS_KEY_EXCHANGE
+ SSH_OPTIONS_KEY_EXCHANGE,
+ SSH_OPTIONS_HOSTKEYS
};
enum {
diff --git a/src/options.c b/src/options.c
index 2b63c92..e96c74a 100644
--- a/src/options.c
+++ b/src/options.c
@@ -334,6 +334,11 @@ int ssh_options_set_algo(ssh_session session, int algo,
* comma-separated list). ex:
* "ecdh-sha2-nistp256,diffie-hellman-group1-sha1"
*
+ * - SSH_OPTIONS_HOSTKEYS:
+ * Set the preferred server host key types (const char *,
+ * comma-separated list). ex:
+ * "ssh-rsa,ssh-dsa,ecdh-sha2-nistp256"
+ *
* - SSH_OPTIONS_COMPRESSION_C_S:
* Set the compression to use for client to server
* communication (const char *, "yes", "no" or a specific
@@ -685,6 +690,16 @@ int ssh_options_set(ssh_session session, enum ssh_options_e type,
return -1;
}
break;
+ case SSH_OPTIONS_HOSTKEYS:
+ v = value;
+ if (v == NULL || v[0] == '\0') {
+ ssh_set_error_invalid(session);
+ return -1;
+ } else {
+ if (ssh_options_set_algo(session, SSH_HOSTKEYS, v) < 0)
+ return -1;
+ }
+ break;
case SSH_OPTIONS_COMPRESSION_C_S:
v = value;
if (v == NULL || v[0] == '\0') {