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

tests: Implement more negative auth tests

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Sahana Prasad <sahana@redhat.com>
This commit is contained in:
Jakub Jelen
2023-10-03 17:44:40 +02:00
committed by Sahana Prasad
parent bac71d1e9c
commit 1fcaac9a35
2 changed files with 16 additions and 0 deletions

View File

@ -296,9 +296,21 @@ static void torture_auth_pubkey(void **state) {
rc = ssh_pki_import_privkey_file(bob_ssh_key, NULL, NULL, NULL, &privkey);
assert_int_equal(rc, SSH_OK);
/* negative tests */
rc = ssh_userauth_try_publickey(NULL, NULL, privkey);
assert_int_equal(rc, SSH_AUTH_ERROR);
rc = ssh_userauth_try_publickey(session, NULL, NULL);
assert_int_equal(rc, SSH_AUTH_ERROR);
rc = ssh_userauth_try_publickey(session, NULL, privkey);
assert_int_equal(rc, SSH_AUTH_SUCCESS);
/* negative tests */
rc = ssh_userauth_publickey(NULL, NULL, privkey);
assert_int_equal(rc, SSH_AUTH_ERROR);
rc = ssh_userauth_publickey(session, NULL, NULL);
assert_int_equal(rc, SSH_AUTH_ERROR);
rc = ssh_userauth_publickey(session, NULL, privkey);
assert_int_equal(rc, SSH_AUTH_SUCCESS);