aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-02-07 13:31:08 +0100
committerAndreas Schneider <asn@cryptomilk.org>2011-02-07 13:31:08 +0100
commit92f20ec85a27cb5634f476ce2e42ec8a973d5215 (patch)
treed8d497a3eef093aa3672f7d5f8763a7bc2720a96 /tests
parenta26194ece01f0bfc4c3da7e005fbfe392848480d (diff)
downloadlibssh-92f20ec85a27cb5634f476ce2e42ec8a973d5215.tar.gz
libssh-92f20ec85a27cb5634f476ce2e42ec8a973d5215.tar.xz
libssh-92f20ec85a27cb5634f476ce2e42ec8a973d5215.zip
torture: Fixed the kbdint auth.
Diffstat (limited to 'tests')
-rw-r--r--tests/torture.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/torture.c b/tests/torture.c
index afbd3dce..b1d5bf61 100644
--- a/tests/torture.c
+++ b/tests/torture.c
@@ -47,17 +47,25 @@ static int _torture_auth_kbdint(ssh_session session,
err = ssh_userauth_kbdint(session, NULL, NULL);
+ if (ssh_userauth_kbdint_getnprompts(session) != 1) {
+ return SSH_AUTH_ERROR;
+ }
+
prompt = ssh_userauth_kbdint_getprompt(session, 0, &echo);
if (prompt == NULL) {
return SSH_AUTH_ERROR;
}
- if (password && strstr(prompt, "Password:")) {
- if (ssh_userauth_kbdint_setanswer(session, 0, password) < 0) {
+ if (ssh_userauth_kbdint_setanswer(session, 0, password) < 0) {
+ return SSH_AUTH_ERROR;
+ }
+ err = ssh_userauth_kbdint(session, NULL, NULL);
+ if (err == SSH_AUTH_INFO) {
+ if (ssh_userauth_kbdint_getnprompts(session) != 0) {
return SSH_AUTH_ERROR;
}
+ err = ssh_userauth_kbdint(session, NULL, NULL);
}
- err = ssh_userauth_kbdint(session, NULL, NULL);
return err;
}