1
1

tests: Verify setting NULL knownhosts does not crash

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Этот коммит содержится в:
Jakub Jelen 2018-11-23 16:38:54 +01:00 коммит произвёл Andreas Schneider
родитель 3da5fcbb56
Коммит db5721d041

Просмотреть файл

@ -12,6 +12,7 @@
#include <libssh/session.h>
#include <libssh/misc.h>
#include <libssh/pki_priv.h>
#include <libssh/options.h>
static int setup(void **state)
{
@ -392,6 +393,16 @@ static void torture_options_set_knownhosts(void **state)
assert_ssh_return_code(session, rc);
assert_string_equal(session->opts.knownhosts,
"/home/libssh/.ssh/known_hosts");
/* The NULL value should not crash the libssh */
rc = ssh_options_set(session, SSH_OPTIONS_KNOWNHOSTS, NULL);
assert_ssh_return_code(session, rc);
assert_null(session->opts.knownhosts);
/* ssh_options_apply() should set the path to correct value */
rc = ssh_options_apply(session);
assert_ssh_return_code(session, rc);
assert_true(session->opts.knownhosts != NULL);
}
static void torture_options_get_knownhosts(void **state)