|
Line
Link Here
|
| 0 |
-- a/kioslave/sftp/kio_sftp.cpp |
0 |
++ b/kioslave/sftp/kio_sftp.cpp |
|
Lines 675-680
Link Here
|
| 675 |
kDebug(KIO_SFTP_DB) << "Trying to authenticate public key"; |
675 |
kDebug(KIO_SFTP_DB) << "Trying to authenticate public key"; |
| 676 |
rc = ssh_userauth_autopubkey(mSession, NULL); |
676 |
rc = ssh_userauth_autopubkey(mSession, NULL); |
| 677 |
if (rc == SSH_AUTH_ERROR) { |
677 |
if (rc == SSH_AUTH_ERROR) { |
|
|
678 |
kDebug(KIO_SFTP_DB) << "Public key authentication failed: " << |
| 679 |
QString::fromUtf8(ssh_get_error(mSession)); |
| 678 |
closeConnection(); |
680 |
closeConnection(); |
| 679 |
error(KIO::ERR_COULD_NOT_LOGIN, i18n("Authentication failed.")); |
681 |
error(KIO::ERR_COULD_NOT_LOGIN, i18n("Authentication failed.")); |
| 680 |
return; |
682 |
return; |
|
Lines 683-703
Link Here
|
| 683 |
} |
685 |
} |
| 684 |
} |
686 |
} |
| 685 |
|
687 |
|
| 686 |
// Try to authenticate with keyboard interactive |
|
|
| 687 |
if (method & SSH_AUTH_METHOD_INTERACTIVE) { |
| 688 |
kDebug(KIO_SFTP_DB) << "Trying to authenticate with keyboard interactive"; |
| 689 |
AuthInfo info2 (info); |
| 690 |
rc = authenticateKeyboardInteractive(info2); |
| 691 |
if (rc == SSH_AUTH_ERROR) { |
| 692 |
closeConnection(); |
| 693 |
error(KIO::ERR_COULD_NOT_LOGIN, i18n("Authentication failed.")); |
| 694 |
return; |
| 695 |
} else if (rc == SSH_AUTH_SUCCESS) { |
| 696 |
info = info2; |
| 697 |
break; |
| 698 |
} |
| 699 |
} |
| 700 |
|
| 701 |
if (!firstTime || mPassword.isEmpty()) { |
688 |
if (!firstTime || mPassword.isEmpty()) { |
| 702 |
|
689 |
|
| 703 |
info.keepPassword = true; // make the "keep Password" check box visible to the user. |
690 |
info.keepPassword = true; // make the "keep Password" check box visible to the user. |
|
Lines 728-733
Link Here
|
| 728 |
closeConnection(); |
715 |
closeConnection(); |
| 729 |
goto login_start; |
716 |
goto login_start; |
| 730 |
} |
717 |
} |
|
|
718 |
|
| 719 |
mUsername = info.username; |
| 720 |
mPassword = info.password; |
| 721 |
} |
| 722 |
|
| 723 |
// Try to authenticate with keyboard interactive |
| 724 |
if (method & SSH_AUTH_METHOD_INTERACTIVE) { |
| 725 |
kDebug(KIO_SFTP_DB) << "Trying to authenticate with keyboard interactive"; |
| 726 |
AuthInfo info2 (info); |
| 727 |
rc = authenticateKeyboardInteractive(info2); |
| 728 |
if (rc == SSH_AUTH_ERROR) { |
| 729 |
kDebug(KIO_SFTP_DB) << "Keyboard interactive authentication failed: " << |
| 730 |
QString::fromUtf8(ssh_get_error(mSession)); |
| 731 |
closeConnection(); |
| 732 |
error(KIO::ERR_COULD_NOT_LOGIN, i18n("Authentication failed.")); |
| 733 |
return; |
| 734 |
} else if (rc == SSH_AUTH_SUCCESS) { |
| 735 |
info = info2; |
| 736 |
break; |
| 737 |
} |
| 731 |
} |
738 |
} |
| 732 |
|
739 |
|
| 733 |
// Try to authenticate with password |
740 |
// Try to authenticate with password |
|
Lines 735-740
Link Here
|
| 735 |
kDebug(KIO_SFTP_DB) << "Trying to authenticate with password"; |
742 |
kDebug(KIO_SFTP_DB) << "Trying to authenticate with password"; |
| 736 |
rc = ssh_userauth_password(mSession, info.username.toUtf8().constData(), info.password.toUtf8().constData()); |
743 |
rc = ssh_userauth_password(mSession, info.username.toUtf8().constData(), info.password.toUtf8().constData()); |
| 737 |
if (rc == SSH_AUTH_ERROR) { |
744 |
if (rc == SSH_AUTH_ERROR) { |
|
|
745 |
kDebug(KIO_SFTP_DB) << "Password authentication failed: " << |
| 746 |
QString::fromUtf8(ssh_get_error(mSession)); |
| 738 |
closeConnection(); |
747 |
closeConnection(); |
| 739 |
error(KIO::ERR_COULD_NOT_LOGIN, i18n("Authentication failed.")); |
748 |
error(KIO::ERR_COULD_NOT_LOGIN, i18n("Authentication failed.")); |
| 740 |
return; |
749 |
return; |
|
Lines 1855-1859
Link Here
|
| 1855 |
finished(); |
1864 |
finished(); |
| 1856 |
return false; |
1865 |
return false; |
| 1857 |
} |
1866 |
} |
|
|
1867 |
if (!mConnected) { |
| 1868 |
return false; |
| 1869 |
} |
| 1870 |
|
| 1858 |
return true; |
1871 |
return true; |
| 1859 |
} |
1872 |
} |