summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Golubev <[email protected]>2024-03-04 21:06:30 +0300
committerAlexander Golubev <[email protected]>2024-03-04 21:06:30 +0300
commit0e615e5c9090c5a0477865db0e687849a04aa5a2 (patch)
tree8d3af7e4d3a8166ac3767eb92fb6fb29fc63ffb0
parent3a4538b4c3da7432407ccab20a9336663f3a1ed8 (diff)
downloadtdebase-0e615e5c9090c5a0477865db0e687849a04aa5a2.tar.gz
tdebase-0e615e5c9090c5a0477865db0e687849a04aa5a2.zip
tdeioslave/sftp: make source c++11-compatible
Signed-off-by: Alexander Golubev <[email protected]>
-rw-r--r--tdeioslave/sftp/tdeio_sftp.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/tdeioslave/sftp/tdeio_sftp.cpp b/tdeioslave/sftp/tdeio_sftp.cpp
index 19b28bdab..0abcd6238 100644
--- a/tdeioslave/sftp/tdeio_sftp.cpp
+++ b/tdeioslave/sftp/tdeio_sftp.cpp
@@ -35,6 +35,7 @@
#include <numeric>
#include <functional>
+#include <vector>
#include <stdlib.h>
#include <unistd.h>
@@ -1136,16 +1137,16 @@ void sftpProtocol::openConnection() {
// Preinit the list of supported auth methods
static const auto authMethodsNormal = [](){
std::vector<std::unique_ptr<SSHAuthMethod>> rv;
- rv.emplace_back(std::make_unique<PublicKeyAuth>());
- rv.emplace_back(std::make_unique<KeyboardInteractiveAuth>());
- rv.emplace_back(std::make_unique<PasswordAuth>());
+ rv.emplace_back(std::unique_ptr<PublicKeyAuth>(new PublicKeyAuth));
+ rv.emplace_back(std::unique_ptr<KeyboardInteractiveAuth>(new KeyboardInteractiveAuth));
+ rv.emplace_back(std::unique_ptr<PasswordAuth>(new PasswordAuth));
return rv;
}();
const static int supportedMethods = std::accumulate(
authMethodsNormal.begin(), authMethodsNormal.end(),
SSH_AUTH_METHOD_NONE, //< none is supported by default
- [](int acc, const auto &m){ return acc |= m->flag(); });
+ [](int acc, const std::unique_ptr<SSHAuthMethod> &m){ return acc |= m->flag(); });
unsigned attemptedMethods = 0;
@@ -1184,8 +1185,10 @@ void sftpProtocol::openConnection() {
if(!mPassword.isEmpty()) {
static const auto authMethodsWithPassword = []() {
std::vector<std::unique_ptr<SSHAuthMethod>> rv;
- rv.emplace_back(std::make_unique<KeyboardInteractiveAuth>(/* noPasswordQuery = */true));
- rv.emplace_back(std::make_unique<PasswordAuth>(/* noPasswordQuery = */true));
+ rv.emplace_back(std::unique_ptr<KeyboardInteractiveAuth>(
+ new KeyboardInteractiveAuth(/* noPasswordQuery = */true) ) );
+ rv.emplace_back(std::unique_ptr<PasswordAuth>(
+ new PasswordAuth(/* noPasswordQuery = */true) ) );
for (const auto &m: authMethodsNormal) { rv.emplace_back(m->clone()); }
return rv;
}();