diff options
author | Alexander Golubev <fatzer2@gmail.com> | 2024-01-21 12:12:53 +0300 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-03-04 23:34:43 +0900 |
commit | 39ee836ae450df66b2fde3697db931aa02a02dbc (patch) | |
tree | 7ff6cb2523750b4c8f088b0f6bc2b6ecebe3d9fd /tdeioslave/sftp/tdeio_sftp.h | |
parent | 2d6f4a3312e358b931fe732001aa7c35199711b1 (diff) | |
download | tdebase-39ee836ae450df66b2fde3697db931aa02a02dbc.tar.gz tdebase-39ee836ae450df66b2fde3697db931aa02a02dbc.zip |
tdeioslave/sftp: overhaul publickey auth
Several enhancements to public key authentication and some other stuff:
- Fix passphrase entry for encrypted keys (was either hanging up or
segfaulting)
- Use scope guard idiom for cleanup calls for more reliable cleanup in
case of errors
- Add normal prompt for public key's passphrase entry dialog
- Correctly differentiate passphrase to password when cached (yes they
are getting cached regardless of keepPassword, at least for some
duration of time)
- Centrilize AuthInfo initialization and some rejig of it
kbd-interactive authentification
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
(cherry picked from commit b91e2203891ce7ef627a241ea05c3f11180fcfc1)
Diffstat (limited to 'tdeioslave/sftp/tdeio_sftp.h')
-rw-r--r-- | tdeioslave/sftp/tdeio_sftp.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/tdeioslave/sftp/tdeio_sftp.h b/tdeioslave/sftp/tdeio_sftp.h index 8e46d815c..2ad069ea7 100644 --- a/tdeioslave/sftp/tdeio_sftp.h +++ b/tdeioslave/sftp/tdeio_sftp.h @@ -31,6 +31,7 @@ #include <tdeio/slavebase.h> #include <kdebug.h> #include <stdint.h> +#include <memory> #include <libssh/libssh.h> #include <libssh/sftp.h> @@ -138,12 +139,24 @@ private: // Private variables // TQString text; //}; - TDEIO::AuthInfo *pubKeyInfo; + /** Some data needed to interact with auth_callback() */ + struct { + /** true if callback was called */ + bool wasCalled; + /** true if user canceled password entry dialog */ + bool wasCanceled; + /** List of keys user was already prompted to enter the passphrase for. + * Note: Under most sane circumstances the list shouldn't go beyond size=2, + * so no fancy containers here + */ + TQStringList attemptedKeys; + } mPubKeyAuthData; private: // private methods - int authenticateKeyboardInteractive(TDEIO::AuthInfo &info); - void clearPubKeyAuthInfo(); + + /** A small helper function to construct auth info skeleton for the protocol */ + TDEIO::AuthInfo authInfo(); void reportError(const KURL &url, const int err); |