aboutsummaryrefslogtreecommitdiff
path: root/tests/client/torture_auth.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-12-15 20:26:17 +0100
committerAndreas Schneider <asn@cryptomilk.org>2013-12-15 20:26:59 +0100
commitce5d421753b48015e737b80bc505d12f4a82bad3 (patch)
treee998bd29d2d3e7ae75a9fd65fc71d6db1c4377bc /tests/client/torture_auth.c
parentfd77439a123fcb40c070d969f3e75b14e524bb10 (diff)
downloadlibssh-ce5d421753b48015e737b80bc505d12f4a82bad3.tar.gz
libssh-ce5d421753b48015e737b80bc505d12f4a82bad3.tar.xz
libssh-ce5d421753b48015e737b80bc505d12f4a82bad3.zip
tests: Use new auth API in the torture_auth test.
Diffstat (limited to 'tests/client/torture_auth.c')
-rw-r--r--tests/client/torture_auth.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/tests/client/torture_auth.c b/tests/client/torture_auth.c
index 83bbd406..cf6da896 100644
--- a/tests/client/torture_auth.c
+++ b/tests/client/torture_auth.c
@@ -64,9 +64,10 @@ static void torture_auth_autopubkey(void **state) {
if (rc == SSH_ERROR) {
assert_true(ssh_get_error_code(session) == SSH_REQUEST_DENIED);
}
- assert_true(ssh_auth_list(session) & SSH_AUTH_METHOD_PUBLICKEY);
+ rc = ssh_userauth_list(session, NULL);
+ assert_true(rc & SSH_AUTH_METHOD_PUBLICKEY);
- rc = ssh_userauth_autopubkey(session, NULL);
+ rc = ssh_userauth_publickey_auto(session, NULL, NULL);
assert_true(rc == SSH_AUTH_SUCCESS);
}
@@ -92,11 +93,11 @@ static void torture_auth_autopubkey_nonblocking(void **state) {
if (rc == SSH_ERROR) {
assert_true(ssh_get_error_code(session) == SSH_REQUEST_DENIED);
}
- assert_true(ssh_auth_list(session) & SSH_AUTH_METHOD_PUBLICKEY);
+ rc = ssh_userauth_list(session, NULL);
ssh_set_blocking(session, 0);
do {
- rc = ssh_userauth_autopubkey(session, NULL);
+ rc = ssh_userauth_publickey_auto(session, NULL, NULL);
} while (rc == SSH_AUTH_AGAIN);
assert_true(rc == SSH_AUTH_SUCCESS);
}
@@ -130,7 +131,8 @@ static void torture_auth_kbdint(void **state) {
if (rc == SSH_ERROR) {
assert_true(ssh_get_error_code(session) == SSH_REQUEST_DENIED);
}
- assert_true(ssh_auth_list(session) & SSH_AUTH_METHOD_INTERACTIVE);
+ rc = ssh_userauth_list(session, NULL);
+ assert_true(rc & SSH_AUTH_METHOD_INTERACTIVE);
rc = ssh_userauth_kbdint(session, NULL, NULL);
assert_true(rc == SSH_AUTH_INFO);
@@ -177,7 +179,9 @@ static void torture_auth_kbdint_nonblocking(void **state) {
if (rc == SSH_ERROR) {
assert_true(ssh_get_error_code(session) == SSH_REQUEST_DENIED);
}
- assert_true(ssh_auth_list(session) & SSH_AUTH_METHOD_INTERACTIVE);
+ rc = ssh_userauth_list(session, NULL);
+ assert_true(rc & SSH_AUTH_METHOD_INTERACTIVE);
+
ssh_set_blocking(session,0);
do {
rc = ssh_userauth_kbdint(session, NULL, NULL);
@@ -231,7 +235,8 @@ static void torture_auth_password(void **state) {
if (rc == SSH_AUTH_ERROR) {
assert_true(ssh_get_error_code(session) == SSH_REQUEST_DENIED);
}
- assert_true(ssh_auth_list(session) & SSH_AUTH_METHOD_PASSWORD);
+ rc = ssh_userauth_list(session, NULL);
+ assert_true(rc & SSH_AUTH_METHOD_PASSWORD);
rc = ssh_userauth_password(session, NULL, password);
assert_true(rc == SSH_AUTH_SUCCESS);
@@ -270,7 +275,8 @@ static void torture_auth_password_nonblocking(void **state) {
if (rc == SSH_AUTH_ERROR) {
assert_true(ssh_get_error_code(session) == SSH_REQUEST_DENIED);
}
- assert_true(ssh_auth_list(session) & SSH_AUTH_METHOD_PASSWORD);
+ rc = ssh_userauth_list(session, NULL);
+ assert_true(rc & SSH_AUTH_METHOD_PASSWORD);
do {
rc = ssh_userauth_password(session, NULL, password);
@@ -304,7 +310,8 @@ static void torture_auth_agent(void **state) {
if (rc == SSH_ERROR) {
assert_true(ssh_get_error_code(session) == SSH_REQUEST_DENIED);
}
- assert_true(ssh_auth_list(session) & SSH_AUTH_METHOD_PUBLICKEY);
+ rc = ssh_userauth_list(session, NULL);
+ assert_true(rc & SSH_AUTH_METHOD_PUBLICKEY);
rc = ssh_userauth_agent(session, NULL);
assert_true(rc == SSH_AUTH_SUCCESS);
@@ -335,7 +342,9 @@ static void torture_auth_agent_nonblocking(void **state) {
if (rc == SSH_ERROR) {
assert_true(ssh_get_error_code(session) == SSH_REQUEST_DENIED);
}
- assert_true(ssh_auth_list(session) & SSH_AUTH_METHOD_PUBLICKEY);
+ rc = ssh_userauth_list(session, NULL);
+ assert_true(rc & SSH_AUTH_METHOD_PUBLICKEY);
+
ssh_set_blocking(session, 0);
do {
rc = ssh_userauth_agent(session, NULL);