aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2018-10-15 11:54:22 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-10-19 12:31:04 +0200
commit85fc0d5b836e728f996ca4b19cf4cbe1c940c384 (patch)
treed206f4d3d47c62f1bd866a5a28d43af74d45b8d1 /src
parent0ff566b6dde5cd27653aa35280feceefad5d5224 (diff)
downloadlibssh-85fc0d5b836e728f996ca4b19cf4cbe1c940c384.tar.gz
libssh-85fc0d5b836e728f996ca4b19cf4cbe1c940c384.tar.xz
libssh-85fc0d5b836e728f996ca4b19cf4cbe1c940c384.zip
options: Add support for getting the known_hosts locations
Fixes T111 Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src')
-rw-r--r--src/options.c14
1 files changed, 14 insertions, 0 deletions
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;