diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d221d71a..ffc2a19b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,6 +55,8 @@ set(MYSQL_INCLUDE_DIR "import/mariadb/include") else(WIN32) +add_subdirectory("dependencies/mariadb-connector-c") + endif(WIN32) diff --git a/dependencies/iroha-ed25519 b/dependencies/iroha-ed25519 index 7307ffb8a..eb4c0fce9 160000 --- a/dependencies/iroha-ed25519 +++ b/dependencies/iroha-ed25519 @@ -1 +1 @@ -Subproject commit 7307ffb8a89d2459f0c07ea5cab27c0d3496df00 +Subproject commit eb4c0fce900e2468b94bb9e9498af626bb66c039 diff --git a/src/cpp/model/Session.cpp b/src/cpp/model/Session.cpp index def731ba5..e1bee67cf 100644 --- a/src/cpp/model/Session.cpp +++ b/src/cpp/model/Session.cpp @@ -19,13 +19,13 @@ using namespace Poco::Data::Keywords; int WriteEmailVerification::run() { Profiler timeUsed; - auto verificationCode = mSession->getEmailVerificationCode(); + Poco::UInt64 verificationCode = mSession->getEmailVerificationCode(); //printf("[WriteEmailVerification::run] E-Mail Verification Code: %llu\n", verificationCode); auto dbSession = ConnectionManager::getInstance()->getConnection(CONNECTION_MYSQL_LOGIN_SERVER); - int user_id = mUser->getDBId(); + //int user_id = mUser->getDBId(); Poco::Data::Statement insert(dbSession); 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()) { mSession->addError(new Error("WriteEmailVerification", "error inserting email verification code")); return -1; @@ -218,7 +218,7 @@ bool Session::createUser(const std::string& name, const std::string& email, cons return true; } -bool Session::updateEmailVerification(unsigned long long emailVerificationCode) +bool Session::updateEmailVerification(Poco::UInt64 emailVerificationCode) { Profiler usedTime; @@ -329,8 +329,9 @@ void Session::detectSessionState() auto dbConnection = ConnectionManager::getInstance()->getConnection(CONNECTION_MYSQL_LOGIN_SERVER); Poco::Data::Statement select(dbConnection); Poco::Nullable passphrase; + auto user_id = mSessionUser->getDBId(); select << "SELECT passphrase from user_backups where user_id = ?;", - into(passphrase), bind(mSessionUser->getDBId()); + into(passphrase), use(user_id); try { if (select.execute() == 1 && !passphrase.isNull()) { updateState(SESSION_STATE_PASSPHRASE_WRITTEN); @@ -363,7 +364,7 @@ Poco::Net::HTTPCookie Session::getLoginCookie() return keks; } -bool Session::loadFromEmailVerificationCode(unsigned long long emailVerificationCode) +bool Session::loadFromEmailVerificationCode(Poco::UInt64 emailVerificationCode) { Profiler usedTime; const static char* funcName = "Session::loadFromEmailVerificationCode"; diff --git a/src/cpp/model/Session.h b/src/cpp/model/Session.h index 88867e35b..1c3dfb17e 100644 --- a/src/cpp/model/Session.h +++ b/src/cpp/model/Session.h @@ -16,6 +16,7 @@ #include "../tasks/MultithreadContainer.h" #include "Poco/Thread.h" +#include "Poco/Types.h" #include "Poco/DateTime.h" #include "Poco/Net/IPAddress.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 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(); diff --git a/src/cpp/model/User.h b/src/cpp/model/User.h index 7c2659358..0450314b2 100644 --- a/src/cpp/model/User.h +++ b/src/cpp/model/User.h @@ -6,6 +6,7 @@ #include "ErrorList.h" #include "Poco/Thread.h" +#include "Poco/Types.h" #include "Poco/Data/Session.h" #include "../tasks/CPUTask.h" @@ -51,7 +52,7 @@ public: Poco::Data::BLOB* encrypt(const ObfusArray* data); protected: - typedef unsigned long long passwordHashed; + typedef Poco::UInt64 passwordHashed; ObfusArray* createCryptoKey(const std::string& password); inline void setCryptoKey(ObfusArray* cryptoKey) { mCryptoKey = cryptoKey; }