mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-07 08:02:55 +03:00
examples: Remove DSA leftovers from sftpserver
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Norbert Pocs <npocs@redhat.com>
This commit is contained in:
@@ -66,7 +66,6 @@ The goal is to show the API in action.
|
|||||||
|
|
||||||
static void set_default_keys(ssh_bind sshbind,
|
static void set_default_keys(ssh_bind sshbind,
|
||||||
int rsa_already_set,
|
int rsa_already_set,
|
||||||
int dsa_already_set,
|
|
||||||
int ecdsa_already_set)
|
int ecdsa_already_set)
|
||||||
{
|
{
|
||||||
if (!rsa_already_set)
|
if (!rsa_already_set)
|
||||||
@@ -74,11 +73,6 @@ static void set_default_keys(ssh_bind sshbind,
|
|||||||
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_RSAKEY,
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_RSAKEY,
|
||||||
KEYS_FOLDER "ssh_host_rsa_key");
|
KEYS_FOLDER "ssh_host_rsa_key");
|
||||||
}
|
}
|
||||||
if (!dsa_already_set)
|
|
||||||
{
|
|
||||||
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_DSAKEY,
|
|
||||||
KEYS_FOLDER "ssh_host_dsa_key");
|
|
||||||
}
|
|
||||||
if (!ecdsa_already_set)
|
if (!ecdsa_already_set)
|
||||||
{
|
{
|
||||||
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_ECDSAKEY,
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_ECDSAKEY,
|
||||||
@@ -114,12 +108,6 @@ static struct argp_option options[] = {
|
|||||||
.doc = "Set a host key. Can be used multiple times. "
|
.doc = "Set a host key. Can be used multiple times. "
|
||||||
"Implies no default keys.",
|
"Implies no default keys.",
|
||||||
.group = 0},
|
.group = 0},
|
||||||
{.name = "dsakey",
|
|
||||||
.key = 'd',
|
|
||||||
.arg = "FILE",
|
|
||||||
.flags = 0,
|
|
||||||
.doc = "Set the dsa key.",
|
|
||||||
.group = 0},
|
|
||||||
{.name = "rsakey",
|
{.name = "rsakey",
|
||||||
.key = 'r',
|
.key = 'r',
|
||||||
.arg = "FILE",
|
.arg = "FILE",
|
||||||
@@ -159,7 +147,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
|
|||||||
* know is a pointer to our arguments structure. */
|
* know is a pointer to our arguments structure. */
|
||||||
ssh_bind sshbind = state->input;
|
ssh_bind sshbind = state->input;
|
||||||
static int no_default_keys = 0;
|
static int no_default_keys = 0;
|
||||||
static int rsa_already_set = 0, dsa_already_set = 0, ecdsa_already_set = 0;
|
static int rsa_already_set = 0, ecdsa_already_set = 0;
|
||||||
|
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
@@ -169,10 +157,6 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
|
|||||||
case 'p':
|
case 'p':
|
||||||
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_BINDPORT_STR, arg);
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_BINDPORT_STR, arg);
|
||||||
break;
|
break;
|
||||||
case 'd':
|
|
||||||
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_DSAKEY, arg);
|
|
||||||
dsa_already_set = 1;
|
|
||||||
break;
|
|
||||||
case 'k':
|
case 'k':
|
||||||
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
|
/* We can't track the types of keys being added with this
|
||||||
@@ -214,7 +198,6 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
|
|||||||
{
|
{
|
||||||
set_default_keys(sshbind,
|
set_default_keys(sshbind,
|
||||||
rsa_already_set,
|
rsa_already_set,
|
||||||
dsa_already_set,
|
|
||||||
ecdsa_already_set);
|
ecdsa_already_set);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -464,7 +447,7 @@ int main(int argc, char **argv)
|
|||||||
(void)argc;
|
(void)argc;
|
||||||
(void)argv;
|
(void)argv;
|
||||||
|
|
||||||
set_default_keys(sshbind, 0, 0, 0);
|
set_default_keys(sshbind, 0, 0);
|
||||||
#endif /* HAVE_ARGP_H */
|
#endif /* HAVE_ARGP_H */
|
||||||
|
|
||||||
if (ssh_bind_listen(sshbind) < 0)
|
if (ssh_bind_listen(sshbind) < 0)
|
||||||
|
Reference in New Issue
Block a user