mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-07-29 13:01:13 +03:00
examples: Remove remaining references to default hostkeys
This is fixup of a9d1cfa9e2
, where we missed this
corner case.
Fixes: #285
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
@ -192,9 +192,6 @@ static struct argp argp = {options, parse_opt, args_doc, doc, NULL, NULL, NULL};
|
|||||||
static int
|
static int
|
||||||
parse_opt(int argc, char **argv, ssh_bind sshbind)
|
parse_opt(int argc, char **argv, ssh_bind sshbind)
|
||||||
{
|
{
|
||||||
int no_default_keys = 0;
|
|
||||||
int rsa_already_set = 0;
|
|
||||||
int ecdsa_already_set = 0;
|
|
||||||
int key;
|
int key;
|
||||||
|
|
||||||
while((key = getopt(argc, argv, "a:e:k:p:P:r:u:v")) != -1) {
|
while((key = getopt(argc, argv, "a:e:k:p:P:r:u:v")) != -1) {
|
||||||
@ -202,16 +199,10 @@ parse_opt(int argc, char **argv, ssh_bind sshbind)
|
|||||||
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_BINDPORT_STR, optarg);
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_BINDPORT_STR, optarg);
|
||||||
} else if (key == 'k') {
|
} else if (key == 'k') {
|
||||||
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_HOSTKEY, optarg);
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_HOSTKEY, optarg);
|
||||||
/* 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;
|
|
||||||
} else if (key == 'r') {
|
} else if (key == 'r') {
|
||||||
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_HOSTKEY, optarg);
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_HOSTKEY, optarg);
|
||||||
rsa_already_set = 1;
|
|
||||||
} else if (key == 'e') {
|
} else if (key == 'e') {
|
||||||
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_HOSTKEY, optarg);
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_HOSTKEY, optarg);
|
||||||
ecdsa_already_set = 1;
|
|
||||||
} else if (key == 'a') {
|
} else if (key == 'a') {
|
||||||
strncpy(authorizedkeys, optarg, DEF_STR_SIZE-1);
|
strncpy(authorizedkeys, optarg, DEF_STR_SIZE-1);
|
||||||
} else if (key == 'u') {
|
} else if (key == 'u') {
|
||||||
@ -256,12 +247,6 @@ parse_opt(int argc, char **argv, ssh_bind sshbind)
|
|||||||
|
|
||||||
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_BINDADDR, argv[optind]);
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_BINDADDR, argv[optind]);
|
||||||
|
|
||||||
if (!no_default_keys) {
|
|
||||||
set_default_keys(sshbind,
|
|
||||||
rsa_already_set,
|
|
||||||
ecdsa_already_set);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_ARGP_H */
|
#endif /* HAVE_ARGP_H */
|
||||||
|
Reference in New Issue
Block a user