From 85fc0d5b836e728f996ca4b19cf4cbe1c940c384 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 15 Oct 2018 11:54:22 +0200 Subject: [PATCH] options: Add support for getting the known_hosts locations Fixes T111 Signed-off-by: Andreas Schneider --- src/options.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/options.c b/src/options.c index 2376b3a6..0e78c85c 100644 --- a/src/options.c +++ b/src/options.c @@ -1022,6 +1022,12 @@ int ssh_options_get_port(ssh_session session, unsigned int* port_target) { * remote host. When not explicitly set, it will be read * from the ~/.ssh/config file. * + * - SSH_OPTIONS_GLOBAL_KNOWNHOSTS: + * Get the path to the global known_hosts file being used. + * + * - SSH_OPTIONS_KNOWNHOSTS: + * Get the path to the known_hosts file being used. + * * @param value The value to get into. As a char**, space will be * allocated by the function for the value, it is * your responsibility to free the memory using @@ -1064,6 +1070,14 @@ int ssh_options_get(ssh_session session, enum ssh_options_e type, char** value) src = session->opts.ProxyCommand; break; } + case SSH_OPTIONS_KNOWNHOSTS: { + src = session->opts.knownhosts; + break; + } + case SSH_OPTIONS_GLOBAL_KNOWNHOSTS: { + src = session->opts.global_knownhosts; + break; + } default: ssh_set_error(session, SSH_REQUEST_DENIED, "Unknown ssh option %d", type); return SSH_ERROR;