more updates for building on linux

This commit is contained in:
Dario Rekowski on RockPI 2019-10-03 10:27:00 +00:00
parent 3eace2dfe4
commit 676c1c2505
5 changed files with 15 additions and 10 deletions

View File

@ -55,6 +55,8 @@ set(MYSQL_INCLUDE_DIR "import/mariadb/include")
else(WIN32) else(WIN32)
add_subdirectory("dependencies/mariadb-connector-c")
endif(WIN32) endif(WIN32)

@ -1 +1 @@
Subproject commit 7307ffb8a89d2459f0c07ea5cab27c0d3496df00 Subproject commit eb4c0fce900e2468b94bb9e9498af626bb66c039

View File

@ -19,13 +19,13 @@ using namespace Poco::Data::Keywords;
int WriteEmailVerification::run() int WriteEmailVerification::run()
{ {
Profiler timeUsed; Profiler timeUsed;
auto verificationCode = mSession->getEmailVerificationCode(); Poco::UInt64 verificationCode = mSession->getEmailVerificationCode();
//printf("[WriteEmailVerification::run] E-Mail Verification Code: %llu\n", verificationCode); //printf("[WriteEmailVerification::run] E-Mail Verification Code: %llu\n", verificationCode);
auto dbSession = ConnectionManager::getInstance()->getConnection(CONNECTION_MYSQL_LOGIN_SERVER); auto dbSession = ConnectionManager::getInstance()->getConnection(CONNECTION_MYSQL_LOGIN_SERVER);
int user_id = mUser->getDBId(); //int user_id = mUser->getDBId();
Poco::Data::Statement insert(dbSession); Poco::Data::Statement insert(dbSession);
insert << "INSERT INTO email_opt_in (user_id, verification_code) VALUES(?,?);", insert << "INSERT INTO email_opt_in (user_id, verification_code) VALUES(?,?);",
use(user_id), bind(verificationCode); bind(mUser->getDBId()), use(verificationCode);
if (1 != insert.execute()) { if (1 != insert.execute()) {
mSession->addError(new Error("WriteEmailVerification", "error inserting email verification code")); mSession->addError(new Error("WriteEmailVerification", "error inserting email verification code"));
return -1; return -1;
@ -218,7 +218,7 @@ bool Session::createUser(const std::string& name, const std::string& email, cons
return true; return true;
} }
bool Session::updateEmailVerification(unsigned long long emailVerificationCode) bool Session::updateEmailVerification(Poco::UInt64 emailVerificationCode)
{ {
Profiler usedTime; Profiler usedTime;
@ -329,8 +329,9 @@ void Session::detectSessionState()
auto dbConnection = ConnectionManager::getInstance()->getConnection(CONNECTION_MYSQL_LOGIN_SERVER); auto dbConnection = ConnectionManager::getInstance()->getConnection(CONNECTION_MYSQL_LOGIN_SERVER);
Poco::Data::Statement select(dbConnection); Poco::Data::Statement select(dbConnection);
Poco::Nullable<Poco::Data::BLOB> passphrase; Poco::Nullable<Poco::Data::BLOB> passphrase;
auto user_id = mSessionUser->getDBId();
select << "SELECT passphrase from user_backups where user_id = ?;", select << "SELECT passphrase from user_backups where user_id = ?;",
into(passphrase), bind(mSessionUser->getDBId()); into(passphrase), use(user_id);
try { try {
if (select.execute() == 1 && !passphrase.isNull()) { if (select.execute() == 1 && !passphrase.isNull()) {
updateState(SESSION_STATE_PASSPHRASE_WRITTEN); updateState(SESSION_STATE_PASSPHRASE_WRITTEN);
@ -363,7 +364,7 @@ Poco::Net::HTTPCookie Session::getLoginCookie()
return keks; return keks;
} }
bool Session::loadFromEmailVerificationCode(unsigned long long emailVerificationCode) bool Session::loadFromEmailVerificationCode(Poco::UInt64 emailVerificationCode)
{ {
Profiler usedTime; Profiler usedTime;
const static char* funcName = "Session::loadFromEmailVerificationCode"; const static char* funcName = "Session::loadFromEmailVerificationCode";

View File

@ -16,6 +16,7 @@
#include "../tasks/MultithreadContainer.h" #include "../tasks/MultithreadContainer.h"
#include "Poco/Thread.h" #include "Poco/Thread.h"
#include "Poco/Types.h"
#include "Poco/DateTime.h" #include "Poco/DateTime.h"
#include "Poco/Net/IPAddress.h" #include "Poco/Net/IPAddress.h"
#include "Poco/Net/HTTPCookie.h" #include "Poco/Net/HTTPCookie.h"
@ -55,9 +56,9 @@ public:
// TODO: check if email exist and if not, fake waiting on password hashing with profiled times of real password hashing // TODO: check if email exist and if not, fake waiting on password hashing with profiled times of real password hashing
bool loadUser(const std::string& email, const std::string& password); bool loadUser(const std::string& email, const std::string& password);
bool loadFromEmailVerificationCode(unsigned long long emailVerificationCode); bool loadFromEmailVerificationCode(Poco::UInt64 emailVerificationCode);
bool updateEmailVerification(unsigned long long emailVerificationCode); bool updateEmailVerification(Poco::UInt64 emailVerificationCode);
Poco::Net::HTTPCookie getLoginCookie(); Poco::Net::HTTPCookie getLoginCookie();

View File

@ -6,6 +6,7 @@
#include "ErrorList.h" #include "ErrorList.h"
#include "Poco/Thread.h" #include "Poco/Thread.h"
#include "Poco/Types.h"
#include "Poco/Data/Session.h" #include "Poco/Data/Session.h"
#include "../tasks/CPUTask.h" #include "../tasks/CPUTask.h"
@ -51,7 +52,7 @@ public:
Poco::Data::BLOB* encrypt(const ObfusArray* data); Poco::Data::BLOB* encrypt(const ObfusArray* data);
protected: protected:
typedef unsigned long long passwordHashed; typedef Poco::UInt64 passwordHashed;
ObfusArray* createCryptoKey(const std::string& password); ObfusArray* createCryptoKey(const std::string& password);
inline void setCryptoKey(ObfusArray* cryptoKey) { mCryptoKey = cryptoKey; } inline void setCryptoKey(ObfusArray* cryptoKey) { mCryptoKey = cryptoKey; }