| 605 | } |
| 606 | |
| 607 | int FTPClientWrapperSSH::authenticate_kbinteractive(ssh_session session) { |
| 608 | int rc; |
| 609 | |
| 610 | KBIntDialog kbdlg; |
| 611 | |
| 612 | rc = ssh_userauth_kbdint(session, NULL, NULL); |
| 613 | int i = 0; //upper bound on challenges, it has got to end at some point |
| 614 | while (rc == SSH_AUTH_INFO && i < 10) { |
| 615 | int res = kbdlg.Create(_MainOutputWindow, session); |
| 616 | if (res == -1) { |
| 617 | OutErr("[SFTP] Error creating interactive dialog"); |
| 618 | return SSH_AUTH_ERROR; |
| 619 | } else if (res != 1 && res != 0) { //1: Gave answer, 0: No input required |
| 620 | OutMsg("[SFTP] Keyboard interactive authentication cancelled."); |
| 621 | return SSH_AUTH_ERROR; |
| 622 | } |
| 623 | rc = ssh_userauth_kbdint(session, NULL, NULL); |
| 624 | i++; |
| 625 | } |
| 626 | |
| 627 | if (rc == SSH_AUTH_DENIED) { |
| 628 | OutMsg("[SFTP] Keyboard interactive authentication denied."); |
| 629 | } |
| 630 | |
| 631 | return rc; |
| 632 | } |
| 633 | |
| 634 | int FTPClientWrapperSSH::verify_knownhost(ssh_session session) { |
| 635 | int state, rc; |