summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Golubev <fatzer2@gmail.com>2024-01-21 15:26:25 +0300
committerMichele Calgaro <michele.calgaro@yahoo.it>2024-03-04 23:34:44 +0900
commitc950ace00f6c9dc13065a14d0c8b17534f39601f (patch)
treed0e317de53cfe59388cc5a72c192ccf8bea2ded7
parentc01b334583849cd1d7de8f39b7fefc0b12b24df1 (diff)
downloadtdebase-c950ace00f6c9dc13065a14d0c8b17534f39601f.tar.gz
tdebase-c950ace00f6c9dc13065a14d0c8b17534f39601f.zip
tdeioslave/sftp: avoid explicit password caching
All password caching we need actually already autmagically done by openPassDlg(). Signed-off-by: Alexander Golubev <fatzer2@gmail.com> (cherry picked from commit a19610bb735faf89fcd27c6885bf81e53c9b2d7a)
-rw-r--r--tdeioslave/sftp/tdeio_sftp.cpp18
-rw-r--r--tdeioslave/sftp/tdeio_sftp.h3
2 files changed, 5 insertions, 16 deletions
diff --git a/tdeioslave/sftp/tdeio_sftp.cpp b/tdeioslave/sftp/tdeio_sftp.cpp
index 7d732fc53..fbb25fa5b 100644
--- a/tdeioslave/sftp/tdeio_sftp.cpp
+++ b/tdeioslave/sftp/tdeio_sftp.cpp
@@ -957,7 +957,6 @@ void sftpProtocol::openConnection() {
{
info = tmpInfo;
mUsername = info.username;
- mPassword = info.password;
}
else if (rc == SSH_AUTH_ERROR)
{
@@ -999,10 +998,10 @@ void sftpProtocol::openConnection() {
<< " to " << info.username << endl;
}
mUsername = info.username;
- mPassword = info.password;
-
+ /* FIXME: libssh doc says that most servers won't allow user switching in-session
+ * <2024-01-21 Fat-Zer> */
rc = ssh_userauth_password(mSession, mUsername.utf8().data(),
- mPassword.utf8().data());
+ info.password.utf8().data());
if (rc == SSH_AUTH_ERROR) {
error(TDEIO::ERR_COULD_NOT_LOGIN, i18n("Authentication failed (method: %1).")
.arg(i18n("password")));
@@ -1031,17 +1030,6 @@ void sftpProtocol::openConnection() {
// Login succeeded!
infoMessage(i18n("Successfully connected to %1").arg(mHost));
- info.url.setProtocol("sftp");
- info.url.setHost(mHost);
- info.url.setPort(mPort);
- info.url.setUser(mUsername);
- info.username = mUsername;
- info.password = mPassword;
-
- kdDebug(TDEIO_SFTP_DB) << "Caching info.username = " << info.username
- << ", info.url = " << info.url.prettyURL() << endl;
-
- cacheAuthentication(info);
//setTimeoutSpecialCommand(TDEIO_SFTP_SPECIAL_TIMEOUT);
diff --git a/tdeioslave/sftp/tdeio_sftp.h b/tdeioslave/sftp/tdeio_sftp.h
index 68c8a0020..f73b37015 100644
--- a/tdeioslave/sftp/tdeio_sftp.h
+++ b/tdeioslave/sftp/tdeio_sftp.h
@@ -118,7 +118,8 @@ private: // Private variables
/** Username to use when connecting */
TQString mUsername;
- /** User's password */
+ /** User's password. Note: the password would be set only if it was passed to
+ * setHost() or received from cache */
TQString mPassword;
/** The open file */