summaryrefslogtreecommitdiffstats
path: root/tdeioslave/sftp/tdeio_sftp.cpp
diff options
context:
space:
mode:
authorAlexander Golubev <[email protected]>2024-02-17 15:59:48 +0300
committerTDE Gitea <[email protected]>2024-03-04 11:04:11 +0000
commit5b9585e42977f46639dc3784352e9c4be4cd9cac (patch)
treeb4bcf97086f7a18ce91cd8fdef5c94992f8dacd9 /tdeioslave/sftp/tdeio_sftp.cpp
parent1597d5f3848cdb39b7d458f0c6c33ecdfc3125d5 (diff)
downloadtdebase-5b9585e42977f46639dc3784352e9c4be4cd9cac.tar.gz
tdebase-5b9585e42977f46639dc3784352e9c4be4cd9cac.zip
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 <[email protected]>
Diffstat (limited to 'tdeioslave/sftp/tdeio_sftp.cpp')
-rw-r--r--tdeioslave/sftp/tdeio_sftp.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/tdeioslave/sftp/tdeio_sftp.cpp b/tdeioslave/sftp/tdeio_sftp.cpp
index 971cdb30d..3c2787255 100644
--- a/tdeioslave/sftp/tdeio_sftp.cpp
+++ b/tdeioslave/sftp/tdeio_sftp.cpp
@@ -173,7 +173,7 @@ void log_callback(ssh_session session, int priority, const char *message,
class PublicKeyAuth: public SSHAuthMethod {
public:
- int flag() override {return SSH_AUTH_METHOD_PUBLICKEY;};
+ unsigned flag() override {return SSH_AUTH_METHOD_PUBLICKEY;};
int authenticate(sftpProtocol *ioslave) const override {
return ioslave->authenticatePublicKey();
}
@@ -184,7 +184,7 @@ class KeyboardInteractiveAuth: public SSHAuthMethod {
public:
KeyboardInteractiveAuth(bool noPaswordQuery = false): mNoPaswordQuery(noPaswordQuery) {}
- int flag() override {return SSH_AUTH_METHOD_INTERACTIVE;};
+ unsigned flag() override {return SSH_AUTH_METHOD_INTERACTIVE;};
int authenticate(sftpProtocol *ioslave) const override {
return ioslave->authenticateKeyboardInteractive(mNoPaswordQuery);
}
@@ -198,7 +198,7 @@ class PasswordAuth: public SSHAuthMethod {
public:
PasswordAuth(bool noPaswordQuery = false): mNoPaswordQuery(noPaswordQuery) {}
- int flag() override {return SSH_AUTH_METHOD_PASSWORD;};
+ unsigned flag() override {return SSH_AUTH_METHOD_PASSWORD;};
int authenticate(sftpProtocol *ioslave) const override {
return ioslave->authenticatePassword(mNoPaswordQuery);
}
@@ -208,7 +208,7 @@ private:
const bool mNoPaswordQuery;
};
-TQString SSHAuthMethod::flagToStr (int m) {
+TQString SSHAuthMethod::flagToStr (unsigned m) {
switch (m) {
case SSH_AUTH_METHOD_NONE : return TQString::fromLatin1 ( "none" );
case SSH_AUTH_METHOD_PASSWORD : return TQString::fromLatin1 ( "password" );
@@ -220,11 +220,11 @@ TQString SSHAuthMethod::flagToStr (int m) {
}
}
-TQStringList SSHAuthMethod::bitsetToStr (int m) {
+TQStringList SSHAuthMethod::bitsetToStr (unsigned m) {
TQStringList rv;
for (int i=0; m>>i; i++) {
- int flag = m & (1 << i);
+ unsigned flag = m & (1 << i);
if (flag) {
rv.append(flagToStr(flag));
}
@@ -1151,7 +1151,7 @@ connection_restart:
SSH_AUTH_METHOD_NONE, //< none is supported by default
[](int acc, const auto &m){ return acc |= m->flag(); });
- int attemptedMethods = 0;
+ unsigned attemptedMethods = 0;
// Backup of the value of the SlaveBase::s_seqNr. This is used to query different data values
// with openPassDlg() with the same seqNr. Otherwise it will result in the prompting of the pass
@@ -1164,7 +1164,7 @@ connection_restart:
// which will require user to provide a valid password at first and then a valid public key.
// see AuthenticationMethods in man 5 sshd_config for more info
bool wasCanceled = false;
- int availableMethodes = ssh_auth_list(mSession);
+ unsigned availableMethodes = ssh_auth_list(mSession);
SlaveBase::s_seqNr = current_seqNr;