From 491b407d178f9f04f7b4b2c43961061d5e557f23 Mon Sep 17 00:00:00 2001 From: Alan Dunn Date: Thu, 27 Mar 2014 08:18:49 -0500 Subject: examples: Update ssh_server_fork for new SSH_BIND_OPTIONS_HOSTKEY Tested by ssh_server_fork -k -k ... and connection succeeded with OpenSSH clients both for ECDSA and RSA (the latter forced via -o HostKeyAlgorithms=ssh-rsa and some known hosts clearing was necessary). Also ssh_server_fork -k -k ... caused the second key to be used, as expected. Signed-off-by: Alan Dunn Reviewed-by: Andreas Schneider --- examples/ssh_server_fork.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/ssh_server_fork.c b/examples/ssh_server_fork.c index 21177f3a..837db6fe 100644 --- a/examples/ssh_server_fork.c +++ b/examples/ssh_server_fork.c @@ -97,7 +97,8 @@ static struct argp_option options[] = { .key = 'k', .arg = "FILE", .flags = 0, - .doc = "Set the host key.", + .doc = "Set a host key. Can be used multiple times. " + "Implies no default keys.", .group = 0 }, { @@ -163,10 +164,11 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state) { dsa_already_set = 1; break; case 'k': - /* This currently sets the public key algorithms the - server is willing to use, not which key files it will - load */ ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_HOSTKEY, arg); + /* We can't track the types of keys being added with this + option, so let's ensure we keep the keys we're adding + by just not setting the default keys */ + no_default_keys = 1; break; case 'r': ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_RSAKEY, arg); -- cgit v1.2.3