From 4c602f225574d0da5833aa7ddf9bffe642046b7b Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 24 Aug 2017 17:44:33 +0200 Subject: options: Use ssh_key_type_e in ssh_options_set_algo() Review with 'git show -b' Signed-off-by: Andreas Schneider --- include/libssh/options.h | 4 +++- src/options.c | 30 ++++++++++++++++-------------- 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; } /** -- cgit v1.2.3