1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-29 01:03:57 +03:00

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>
This commit is contained in:
Jakub Jelen
2017-11-13 11:51:52 +01:00
committed by Andreas Schneider
parent f818e63f8f
commit 4166bb2a26

View File

@@ -238,6 +238,16 @@ int ssh_options_set_algo(ssh_session session,
* are genuine. It may include "%s" which will be * are genuine. It may include "%s" which will be
* replaced by the user home directory. * 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: * - SSH_OPTIONS_IDENTITY:
* Set the identity file name (const char *,format string).\n * Set the identity file name (const char *,format string).\n
* \n * \n
@@ -600,7 +610,14 @@ int ssh_options_set(ssh_session session, enum ssh_options_e type,
case SSH_OPTIONS_GLOBAL_KNOWNHOSTS: case SSH_OPTIONS_GLOBAL_KNOWNHOSTS:
v = value; v = value;
SAFE_FREE(session->opts.global_knownhosts); 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); ssh_set_error_invalid(session);
return -1; return -1;
} else { } else {