diff options
author | Alexander Golubev <fatzer2@gmail.com> | 2024-01-21 12:12:53 +0300 |
---|---|---|
committer | TDE Gitea <gitea@mirror.git.trinitydesktop.org> | 2024-03-04 11:04:10 +0000 |
commit | b91e2203891ce7ef627a241ea05c3f11180fcfc1 (patch) | |
tree | 579f56e16e8db0fa0654145c18259fe5de963d3b /tdeioslave/sftp/tdeio_sftp.h | |
parent | a1fa8a79bbd7f6385d312cce709768944506d960 (diff) | |
download | tdebase-b91e2203891ce7ef627a241ea05c3f11180fcfc1.tar.gz tdebase-b91e2203891ce7ef627a241ea05c3f11180fcfc1.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>
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); |