aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2012-10-07 23:21:17 +0200
committerAndreas Schneider <asn@cryptomilk.org>2012-10-07 23:21:17 +0200
commite17fcd70f9e6e5828386419d9a6346d34fa5a43f (patch)
tree47b69198d84c79f19e8fae414344d1a0a5f2cecc
parent5f0f334d1c8922396949b2822a6e1bebb9c42b7c (diff)
downloadlibssh-e17fcd70f9e6e5828386419d9a6346d34fa5a43f.tar.gz
libssh-e17fcd70f9e6e5828386419d9a6346d34fa5a43f.tar.xz
libssh-e17fcd70f9e6e5828386419d9a6346d34fa5a43f.zip
torture: Use new userauth functions.
-rw-r--r--tests/torture.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/torture.c b/tests/torture.c
index a0a3812f..448fafef 100644
--- a/tests/torture.c
+++ b/tests/torture.c
@@ -156,6 +156,7 @@ ssh_session torture_ssh_session(const char *host,
const char *user,
const char *password) {
ssh_session session;
+ int method;
int rc;
if (host == NULL) {
@@ -192,14 +193,20 @@ ssh_session torture_ssh_session(const char *host,
if (rc == SSH_ERROR) {
goto failed;
}
- if (!(ssh_auth_list(session) & SSH_AUTH_METHOD_INTERACTIVE)) {
+ method = ssh_userauth_list(session, NULL);
+ if (method == 0) {
goto failed;
}
if (password != NULL) {
- rc = _torture_auth_kbdint(session, password);
+ if (method & SSH_AUTH_METHOD_INTERACTIVE) {
+ rc = _torture_auth_kbdint(session, password);
+ }
+ if (method & SSH_AUTH_METHOD_PASSWORD) {
+ rc = ssh_userauth_password(session, NULL, password);
+ }
} else {
- rc = ssh_userauth_autopubkey(session, NULL);
+ rc = ssh_userauth_publickey_auto(session, NULL, NULL);
if (rc == SSH_AUTH_ERROR) {
goto failed;
}