summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Golubev <fatzer2@gmail.com>2024-03-04 21:06:30 +0300
committerSlávek Banko <slavek.banko@axis.cz>2024-03-04 19:57:52 +0100
commite3c4e755a7e13d4223f8de98a68c8b4af031c013 (patch)
treea14c1d4a3b431d87aec69216395710bfa68ddda6
parente41e8b9e6a12abe230f1ab40c1a4791f014352a4 (diff)
downloadtdebase-e3c4e755a7e13d4223f8de98a68c8b4af031c013.tar.gz
tdebase-e3c4e755a7e13d4223f8de98a68c8b4af031c013.zip
tdeioslave/sftp: make source c++11-compatible
Signed-off-by: Alexander Golubev <fatzer2@gmail.com> (cherry picked from commit 0e615e5c9090c5a0477865db0e687849a04aa5a2)
-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;
}();