aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2017-11-13 11:51:52 +0100
committerAndreas Schneider <asn@cryptomilk.org>2017-12-15 12:00:49 +0100
commit4166bb2a26557858d31f422c18c1f687172bf911 (patch)
treea4e258256abb3d353a3dedde1ba5d16a37af6e50 /src
parentf818e63f8f3efaea3daf737d280450209c806541 (diff)
downloadlibssh-4166bb2a26557858d31f422c18c1f687172bf911.tar.gz
libssh-4166bb2a26557858d31f422c18c1f687172bf911.tar.xz
libssh-4166bb2a26557858d31f422c18c1f687172bf911.zip
options: Document SSH_OPTIONS_GLOBAL_KNOWNHOSTS and set default value
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src')
-rw-r--r--src/options.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/options.c b/src/options.c
index 0bc15497..54e768e5 100644
--- a/src/options.c
+++ b/src/options.c
@@ -238,6 +238,16 @@ int ssh_options_set_algo(ssh_session session,
* are genuine. It may include "%s" which will be
* replaced by the user home directory.
*
+ * - SSH_OPTIONS_GLOBAL_KNOWNHOSTS:
+ * Set the global known hosts file name (const char *,format string).\n
+ * \n
+ * If the value is NULL, the directory is set to the
+ * default global known hosts file, normally
+ * /etc/ssh/ssh_known_hosts.\n
+ * \n
+ * The known hosts file is used to certify remote hosts
+ * are genuine.
+ *
* - SSH_OPTIONS_IDENTITY:
* Set the identity file name (const char *,format string).\n
* \n
@@ -600,7 +610,14 @@ int ssh_options_set(ssh_session session, enum ssh_options_e type,
case SSH_OPTIONS_GLOBAL_KNOWNHOSTS:
v = value;
SAFE_FREE(session->opts.global_knownhosts);
- if (v == NULL || v[0] == '\0') {
+ if (v == NULL) {
+ session->opts.global_knownhosts =
+ strdup("/etc/ssh/ssh_known_hosts");
+ if (session->opts.global_knownhosts == NULL) {
+ ssh_set_error_oom(session);
+ return -1;
+ }
+ } else if (v[0] == '\0') {
ssh_set_error_invalid(session);
return -1;
} else {