diff options
author | Alexander Golubev <[email protected]> | 2024-01-29 20:56:34 +0300 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2024-03-04 23:34:45 +0900 |
commit | ef56a87ffe8f80db2c06518788873e20f6991624 (patch) | |
tree | d5b613184fccef4c441f91e5b442692972f89b20 /tdeioslave/sftp/tdeio_sftp.h | |
parent | fae96a29fb62f852eaf4a6a638c0d08258ed427d (diff) | |
download | tdebase-ef56a87ffe8f80db2c06518788873e20f6991624.tar.gz tdebase-ef56a87ffe8f80db2c06518788873e20f6991624.zip |
tdeioslave/sftp: save/restore seqNr for multi-factor auth
In case the server is set up for multi-factor authentication we could
be have to query several things from the user like password, a key
passphrase, their mother's maiden name etc. It doesn't make a big
difference during an initial connection, but it butchers the
reconnection process: it can retrieve the answer of the user to the
first question (e.g. their password), but it fails to retrieve the
second one (e.g. the key passphrase). So the user would be forced to
reenter the answer for the second question upon each reconnection.
The reason for this is the passwdserver's desig (see DESIGN [1]):
Each query for AuthInfo with the openPassDlg() has an secNr number
associated with it. If it's smaller than the one of the one stored for
the privious request, than the one from the cache will be returned
automagically, if it's bigger the dialog will be prompted to the user.
Each call to openPassDlg() advances s_seqNr to the last value reported
by the passwdserver. So the first call will return the cached value and
subsequent calls will actually display the dialog to the user (assuming
authentication with the cached data failed).
But in case of multi-factor auth we have to query user for several
independent values. And we want to try to retrieve each one of those
from the cache. So we have to get a bit hacky and manually manipulate
the SlaveBase::s_seqNr value.
[1]: https://mirror.git.trinitydesktop.org/gitea/TDE/tdelibs/src/branch/master/tdeio/kpasswdserver/DESIGN
Signed-off-by: Alexander Golubev <[email protected]>
(cherry picked from commit 95b18e63382c4f0013c4eb2473d04f6020a84b7a)
Diffstat (limited to 'tdeioslave/sftp/tdeio_sftp.h')
-rw-r--r-- | tdeioslave/sftp/tdeio_sftp.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tdeioslave/sftp/tdeio_sftp.h b/tdeioslave/sftp/tdeio_sftp.h index 6a33dc8a0..84e3e47c3 100644 --- a/tdeioslave/sftp/tdeio_sftp.h +++ b/tdeioslave/sftp/tdeio_sftp.h @@ -160,6 +160,8 @@ private: // Private variables * so no fancy containers here */ TQStringList attemptedKeys; + /** A backup for SlaveBase::s_seqNr to pass the same value to prompts for different keys */ + long current_seqNr; /** true if callback was called */ bool wasCalled; /** true if user canceled password entry dialog */ |