mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-07-31 00:03:07 +03:00
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>
This commit is contained in:
committed by
Andreas Schneider
parent
2f4589b765
commit
491b407d17
@ -97,7 +97,8 @@ static struct argp_option options[] = {
|
|||||||
.key = 'k',
|
.key = 'k',
|
||||||
.arg = "FILE",
|
.arg = "FILE",
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.doc = "Set the host key.",
|
.doc = "Set a host key. Can be used multiple times. "
|
||||||
|
"Implies no default keys.",
|
||||||
.group = 0
|
.group = 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -163,10 +164,11 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state) {
|
|||||||
dsa_already_set = 1;
|
dsa_already_set = 1;
|
||||||
break;
|
break;
|
||||||
case 'k':
|
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);
|
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;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_RSAKEY, arg);
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_RSAKEY, arg);
|
||||||
|
Reference in New Issue
Block a user