Commit Graph

247 Commits (4449d863b2c2b191076f8af357a2e456b37c1701)

Author SHA1 Message Date
Alexander Golubev 0e615e5c90 tdeioslave/sftp: make source c++11-compatible
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
12 months ago
Alexander Golubev 3a4538b4c3 tdeioslave/sftp: get rid of goto in openConnection()
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
12 months ago
Alexander Golubev 5b9585e429 tdeioslave/sftp: use unsigned to store auth method flags/bitsets
The libssh defines those flags as unsigned. Technically ssh_auth_list()
still returns int, but its guranteed to be bitset of those flags.

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
12 months ago
Alexander Golubev 1597d5f384 tdeioslave/sftp: better erros for unsupported auth methods
Also:
- do not translate auth methods names as the names appear in config
  files verbatim
- libssh actually doesn't supports hostbased auth, so exclude it from
  bitset of supported

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
12 months ago
Alexander Golubev 4b4b72db8f tdeioslave/sftp: better cancelation handling in case of several publickeys
Consider publickey auth canceled only if user canceled it for each of
the prompted keys.

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
12 months ago
Alexander Golubev 95b18e6338 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 <fatzer2@gmail.com>
12 months ago
Alexander Golubev 4d88b3eddd tdeioslave/sftp: imbue error messages with errors from libssh
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
12 months ago
Alexander Golubev ee73349644 tdeioslave/sftp: cache passwords in case they were passed to setHost()
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
12 months ago
Alexander Golubev f8f0b8815c tdeioslave/sftp: prevent infinite looping in kb-interactive auth
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
12 months ago
Alexander Golubev 21ce69f338 tdeioslave/sftp: purge password in the destructor
This could be useful in case the destructor will be called before
openConnection()

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
12 months ago
Alexander Golubev 009382772d tdeioslave/sftp: enable changing user during kb-interactive auth
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
12 months ago
Alexander Golubev 581d266ae6 tdeioslave/sftp: pass correct username to openPassDlg()
We should always pass to the openPassDlg() exactly the same username
otherwise it may result in incorrect caching of passwords especially in
case if the username is changed by the user.

Also don't allow username change in case it was passed to setHost()
(i.e. it was specified in the URL like e.g. sftp://username@host/).
In such a case after changing it'd be impossible to properly cache it.

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
12 months ago
Alexander Golubev 2756ae762f tdeioslave/sftp: even bigger authentication overhaul
- Move authentication methods into separate functions so it would be
  easier to correctly handle error after those and select which should
  be called in which order.
- A lot of minor improvements along the way

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
12 months ago
Alexander Golubev d316ff14bd tdeioslave/sftp: use realmValue to distinguish different prompts
This will help kpasswdserver not to confuse different user's answers to
different questions.

Also avoid passing/returning TDE::AuthInfo for kb-interactive auth as it
isn't really necessary when we don't manually caching passwords anymore.

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
12 months ago
Alexander Golubev a19610bb73 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>
12 months ago
Alexander Golubev 9c0a0ce976 tdeioslave/sftp: use a scope guards to close connection
There were a couple of missing closeConnection() calls after connection
errors. The probably haven't caused any major bugs, but use scope guards
to be on the safe side.

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
12 months ago
Alexander Golubev 75349be43e tdeioslave/sftp: split off connection init to a dedicated function
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
12 months ago
Alexander Golubev 688544193f tdeioslave/sftp: use free to destroy mCallbacks
As it allocated via malloc() rather than new.

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
12 months ago
Alexander Golubev b91e220389 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>
12 months ago
Alexander Golubev a1fa8a79bb tdeioslave/sftp: fix keyboard-interactive authentication
This is a partial fix to the sftp ioslave. Subsequent commits will fix
other issues.

Closes: https://mirror.git.trinitydesktop.org/gitea/TDE/tdebase/issues/443
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
12 months ago
Michele Calgaro 2d7d2122cf
Replace Q_WS_* defines with TQ_WS_* equivalents
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
1 year ago
Michele Calgaro 0d9263f836
Replace Q_SIGNALS and Q_SLOTS
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
1 year ago
Michele Calgaro 4484e51ca6
Replace auto_ptr
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
1 year ago
Michele Calgaro a4241b7911
Use new TQ_METHOD, TQ_SIGNAL, TQ_SLOT defines
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
1 year ago
Michele Calgaro 55af17246c
Remove usage of TDEDiskDeviceStatus::Hotpluggable
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
1 year ago
Michele Calgaro c4a6487c82
Replace various '#define' strings - part 6
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
1 year ago
Alexander Golubev f2dbf5b903 Make dependency upon libssh optional
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
1 year ago
Michele Calgaro 82c1dbe490
Replaced various '#define' with actual strings - part 4
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
1 year ago
Michele Calgaro 36f2e08fd3
Replaced various '#define' with actual strings - part 3
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
1 year ago
Michele Calgaro b965cbac5b
Replace Qt with TQt
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
1 year ago
Michele Calgaro 33c7d15989
Replace QObject, QWidget, QImage, QPair, QRgb, QColor, QChar, QString, QIODevice with TQ* version
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
1 year ago
Michele Calgaro 75a74bedae
Replace various Q_* and QT_* defines with TQ_* and TQT_*
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
1 year ago
Michele Calgaro 014f6d2586
Drop USE_TQT4 code
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
2 years ago
Michele Calgaro 7bc43c68b3
Drop TQT_TQ*_OBJECT defines
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
2 years ago
Michele Calgaro 814bf5fc4f
Replace Q_OBJECT with TQ_OBJECT
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
2 years ago
Michele Calgaro 22625693f1
Replace _OBJECT_NAME_STRING defines with actual strings. This relates to the merging of tqtinterface with tqt3.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
2 years ago
Denis Kozadaev 4d58a4ea8d
SunOS specific patches
Signed-off-by: Denis Kozadaev <denis@dilos.org>
2 years ago
Michele Calgaro ef300a683d
hwmanager: use alphabetically sorted menus in tdehwdevicetray.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
2 years ago
Michele Calgaro e35bb1ed56
tdeioslave mediamanager: show the device node in the label also for removable drives and CD/DVD disks.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
2 years ago
Mavridis Philippe d6db1a583c
SFTP: compatibility with older libssh versions
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
3 years ago
Mavridis Philippe 7f277bc5e1
SFTP: Various fixes and improvements
For details see PR #279.

Portions of code borrowed from KDE5 SFTP ioslave:

Source:  https://invent.kde.org/network/kio-extras/-/blob/master/sftp/kio_sftp.cpp
Licence: LGPLv2 or later

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
3 years ago
Mavridis Philippe fd94618b63
Replaced old sftp ioslave with backported version
Source:  https://github.com/sandsmark/kde2-kio-sftp-kde4
Licence: GPLv2 or later

This resolves issue #276.

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
3 years ago
Mavridis Philippe d59c8ee79f
FISH: Security fix backport from KDE
"Only store password in KWallet if the user asked for it"
d813cef3ce

Author:  David Faure
Licence: GPLv2

This mitigates CVE-2020-12755.

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
3 years ago
Michele Calgaro cc94c3dc36
tdeio-man: add TDE specific man folder to the list of the search paths.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
3 years ago
Michele Calgaro 4974727d50
Add 'safeRemove' and 'safeRemoveByNode' to mediamanager DCOP interface.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
3 years ago
Michele Calgaro 88d92af3c1
hwmanager: use tdeio_media_mounthelper process to
mount/unmout/lock/unlock/ejct media devices.
This ensures a consistent media device status also with complex
partition structures and LUKS encryption.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
3 years ago
Michele Calgaro 40ef766f02
tdeio media: add releaseHolders parameter to lock/lockByNode dcop calls.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
3 years ago
Michele Calgaro c787e7a715
mediamanager: fix name of available backends in error messages.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
3 years ago
Michele Calgaro 8d0f49aeb4
Added 'eject' and 'ejectByNode' to mediamanager DCOP interface.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
3 years ago
Michele Calgaro f9f7aee79e Removed HAL dependant code.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
3 years ago