From 3602fd479b06f8802c5c770ba823fd0721f345fd Mon Sep 17 00:00:00 2001 From: Pedro Pinto Date: Thu, 5 Apr 2018 17:14:36 -0400 Subject: [PATCH] Made secure logon work a bit more portable --- src/lib/utils/SecureLogon.cpp | 16 +++++++++++++--- src/server/sparkd/jetfix/gateway/Session.cpp | 2 ++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/lib/utils/SecureLogon.cpp b/src/lib/utils/SecureLogon.cpp index 608ae95f5..cc1ee7c38 100644 --- a/src/lib/utils/SecureLogon.cpp +++ b/src/lib/utils/SecureLogon.cpp @@ -1,10 +1,17 @@ #ifndef _WIN32 #include "SecureLogon.h" + +#ifndef BTS_EDGE #include "lib/utils/bts_assert.h" #include "lib/utils/datetime.h" - #include "lib/config/config.h" #include "lib/config/protos/system.pb.h" +#else +#include "bts_assert.h" +#include "core/bts_core/config/config.h" +#include "core/bts_core/config/system.pb.h" +#include "core/bts_core/utils/datetime.h" +#endif // libcrypto++-dev #include @@ -12,6 +19,7 @@ #include #include +#include #include #include #include @@ -43,7 +51,9 @@ std::tuple load_session_keys(const string& session) { auto path = bts::config::get().data_path() + "glbx_logon/"; if (is_directory(path)) { // iterate though each file - for (const auto& f : directory_iterator(path)) { + directory_iterator end; + for(auto iter = directory_iterator(path); iter != end; ++iter) { + auto& f = *iter; std::ifstream input(f.path().string()); while (input && !input.eof()) { // iterate though each line @@ -59,7 +69,7 @@ std::tuple load_session_keys(const string& session) { auto create_date = *(++t); auto expiration_date = *(++t); if (!is_expired(expiration_date)) { - return {id,secret}; + return std::make_tuple(id, secret); } } } diff --git a/src/server/sparkd/jetfix/gateway/Session.cpp b/src/server/sparkd/jetfix/gateway/Session.cpp index 70a4699e6..3e59e760a 100644 --- a/src/server/sparkd/jetfix/gateway/Session.cpp +++ b/src/server/sparkd/jetfix/gateway/Session.cpp @@ -758,7 +758,9 @@ OutFIXPtr make_logon (uint32_t seq_num, "O2", "1.0", "BTS"); + #ifndef BTS_EDGE LOG(Jetfix,Info,"Canonical string for secure logon: {}", ld.canonical); + #endif buffer.add(ld.access_key.size()); buffer.add(ld.access_key); buffer.add("CME-1-SHA-256");