diff options
author | Alan Dunn <amdunn@gmail.com> | 2014-03-27 08:18:49 -0500 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2014-04-09 10:59:21 +0200 |
commit | 491b407d178f9f04f7b4b2c43961061d5e557f23 (patch) | |
tree | 68ca8725a8a19dcdc29e1237860936b4d1973aa6 /examples | |
parent | 2f4589b76551b4c268596f521665b9395734f7b2 (diff) | |
download | libssh-491b407d178f9f04f7b4b2c43961061d5e557f23.tar.gz libssh-491b407d178f9f04f7b4b2c43961061d5e557f23.tar.xz libssh-491b407d178f9f04f7b4b2c43961061d5e557f23.zip |
examples: Update ssh_server_fork for new SSH_BIND_OPTIONS_HOSTKEY
Tested by
ssh_server_fork -k <an ecdsa key> -k <an rsa key> ...
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 <an ecdsa key> -k <another ecdsa key> ...
caused the second key to be used, as expected.
Signed-off-by: Alan Dunn <amdunn@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/ssh_server_fork.c | 10 |
1 files 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); |