Made secure logon work a bit more portable
This commit is contained in:
1 parent
335d590106
commit
3602fd479b
2 files changed
+15
-3
No files matched your search
@@ -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 <cryptopp/hmac.h>
|
||||
@@ -12,6 +19,7 @@
|
||||
#include <cryptopp/base64.h>
|
||||
#include <cryptopp/filters.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/tokenizer.hpp>
|
||||
#include <fstream>
|
||||
@@ -43,7 +51,9 @@ std::tuple<string, string> load_session_keys(const string& session) {
|
||||
auto path = bts::config::get<bts::config::System>().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<string, string> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user