diff options
author | Jakub Jelen <jjelen@redhat.com> | 2017-11-13 11:51:52 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2017-12-15 12:00:49 +0100 |
commit | 4166bb2a26557858d31f422c18c1f687172bf911 (patch) | |
tree | a4e258256abb3d353a3dedde1ba5d16a37af6e50 /src | |
parent | f818e63f8f3efaea3daf737d280450209c806541 (diff) | |
download | libssh-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.c | 19 |
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 { |