http://bugs.gentoo.org/show_bug.cgi?id=296816 Author: Peter Volkov with some ideas from Jonathan-Christofer Demay. === modified file 'configure' --- configure 2009-12-15 08:46:59 +0000 +++ configure 2009-12-17 08:26:59 +0000 @@ -243,11 +243,11 @@ if [ -n "$SSH_PATH" ]; then echo " ... found" - echo 'NOTE: ensure that you have libssh v0.11 installed!! Get it from http://0xbadc0de.be !' + echo 'NOTE: ensure that you have libssh v0.4 or later installed!! Get it from http://www.libssh.org !' fi if [ "X" = "X$SSH_PATH" ]; then echo " ... NOT found, module ssh2 disabled" - echo 'Get it from http://0xbadc0de.be/ - use v0.11!' + echo 'Get it from http://www.libssh.org/ - use v0.4!' fi if [ "$SSH_IPATH" = "/usr/include" ]; then SSH_IPATH="" === modified file 'hydra-ssh2.c' --- hydra-ssh2.c 2009-12-15 08:46:59 +0000 +++ hydra-ssh2.c 2009-12-18 10:21:52 +0000 @@ -7,31 +7,70 @@ } #else -#warning "If compilation of hydra-ssh2 fails, you are not using v0.11. Download from http://www.0xbadc0de.be/" - #include extern char *HYDRA_EXIT; +/* try to authenticate with one password */ +static int +try_password(ssh_session ssh_session, const char *login, const char *password){ + int auth_state; + int i, j, n; + int methods; + +#ifdef DEBUG_SSH2 + printf("[DEBUG] try_password(): trying login = \"%s\", pass \"%s\"\n", login, password); +#endif + + methods = ssh_auth_list(ssh_session); + if (methods & SSH_AUTH_METHOD_INTERACTIVE) { +#ifdef DEBUG_SSH2 + printf("[DEBUG] try_password(): trying keyboard interactive method\n"); +#endif + auth_state = ssh_userauth_kbdint(ssh_session, login, NULL); + /* For safety we'll limit number of prompts to 33 */ + for(j=0; auth_state == SSH_AUTH_INFO && j<33; j++) { + n=ssh_userauth_kbdint_getnprompts(ssh_session); + for(i=0; i