aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2017-08-24 17:44:33 +0200
committerAndreas Schneider <asn@cryptomilk.org>2017-08-24 18:01:41 +0200
commit4c602f225574d0da5833aa7ddf9bffe642046b7b (patch)
treef0aeade8b40da683817ebe62080e53f0f1ffcda9
parent6803c2f86d5a8f419d854dbffb78c10fda611ed2 (diff)
downloadlibssh-4c602f225574d0da5833aa7ddf9bffe642046b7b.tar.gz
libssh-4c602f225574d0da5833aa7ddf9bffe642046b7b.tar.xz
libssh-4c602f225574d0da5833aa7ddf9bffe642046b7b.zip
options: Use ssh_key_type_e in ssh_options_set_algo()
Review with 'git show -b' Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--include/libssh/options.h4
-rw-r--r--src/options.c30
2 files changed, 19 insertions, 15 deletions
diff --git a/include/libssh/options.h b/include/libssh/options.h
index 4078ad08..5b1cb9f0 100644
--- a/include/libssh/options.h
+++ b/include/libssh/options.h
@@ -22,7 +22,9 @@
#define _OPTIONS_H
int ssh_config_parse_file(ssh_session session, const char *filename);
-int ssh_options_set_algo(ssh_session session, int algo, const char *list);
+int ssh_options_set_algo(ssh_session session,
+ enum ssh_kex_types_e algo,
+ const char *list);
int ssh_options_apply(ssh_session session);
#endif /* _OPTIONS_H */
diff --git a/src/options.c b/src/options.c
index f0e67783..9346b6d1 100644
--- a/src/options.c
+++ b/src/options.c
@@ -162,22 +162,24 @@ int ssh_options_copy(ssh_session src, ssh_session *dest) {
return 0;
}
-int ssh_options_set_algo(ssh_session session, int algo,
- const char *list) {
- char *p = NULL;
-
- p = ssh_keep_known_algos(algo, list);
- if (p == NULL) {
- ssh_set_error(session, SSH_REQUEST_DENIED,
- "Setting method: no algorithm for method \"%s\" (%s)",
- ssh_kex_get_description(algo), list);
- return -1;
- }
+int ssh_options_set_algo(ssh_session session,
+ enum ssh_kex_types_e algo,
+ const char *list)
+{
+ char *p = NULL;
+
+ p = ssh_keep_known_algos(algo, list);
+ if (p == NULL) {
+ ssh_set_error(session, SSH_REQUEST_DENIED,
+ "Setting method: no algorithm for method \"%s\" (%s)",
+ ssh_kex_get_description(algo), list);
+ return -1;
+ }
- SAFE_FREE(session->opts.wanted_methods[algo]);
- session->opts.wanted_methods[algo] = p;
+ SAFE_FREE(session->opts.wanted_methods[algo]);
+ session->opts.wanted_methods[algo] = p;
- return 0;
+ return 0;
}
/**