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:
committed by
Sahana Prasad
parent
bac71d1e9c
commit
1fcaac9a35
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user