1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-07-31 00:03:07 +03:00

torture_options.c: Add identity test for ssh_options_copy

Test if the ssh_options_apply is called on session before ssh_options_copy,
then `opts.identity` ssh_list will be copied

Signed-off-by: Norbert Pocs <npocs@redhat.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Norbert Pocs
2022-11-16 17:17:14 +01:00
committed by Jakub Jelen
parent 1bd499febb
commit c0c063f94c

View File

@ -918,6 +918,34 @@ static void torture_options_copy(void **state)
sizeof(session->opts.options_seen));
ssh_free(new);
/* test if ssh_options_apply was called before ssh_options_copy
* the opts.identity list gets copied (percent expanded list) */
rv = ssh_options_apply(session);
assert_ssh_return_code(session, rv);
rv = ssh_options_copy(session, &new);
assert_ssh_return_code(session, rv);
assert_non_null(new);
it = ssh_list_get_iterator(session->opts.identity_non_exp);
assert_null(it);
it2 = ssh_list_get_iterator(new->opts.identity_non_exp);
assert_null(it2);
it = ssh_list_get_iterator(session->opts.identity);
assert_non_null(it);
it2 = ssh_list_get_iterator(new->opts.identity);
assert_non_null(it2);
while (it != NULL && it2 != NULL) {
assert_string_equal(it->data, it2->data);
it = it->next;
it2 = it2->next;
}
assert_null(it);
assert_null(it2);
ssh_free(new);
}
#define EXECUTABLE_NAME "test-exec"