diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2011-02-07 13:31:08 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2011-02-07 13:31:08 +0100 |
commit | 92f20ec85a27cb5634f476ce2e42ec8a973d5215 (patch) | |
tree | d8d497a3eef093aa3672f7d5f8763a7bc2720a96 /tests | |
parent | a26194ece01f0bfc4c3da7e005fbfe392848480d (diff) | |
download | libssh-92f20ec85a27cb5634f476ce2e42ec8a973d5215.tar.gz libssh-92f20ec85a27cb5634f476ce2e42ec8a973d5215.tar.xz libssh-92f20ec85a27cb5634f476ce2e42ec8a973d5215.zip |
torture: Fixed the kbdint auth.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/torture.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/torture.c b/tests/torture.c index afbd3dc..b1d5bf6 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; } |