Skip to content
Permalink
Browse files

Merge PR #3645: Fix log spacing and typos when setting up the PBKDF2 …

…iteration count
  • Loading branch information...
davidebeatrici committed Mar 25, 2019
2 parents f8ba6e0 + afa9f83 commit 15072a4505af39f254fe0d35357d95b9a121e991
Showing with 12 additions and 12 deletions.
  1. +11 −11 src/murmur/ServerDB.cpp
  2. +1 −1 src/murmur/ServerDB.h
@@ -51,32 +51,32 @@ QSqlDatabase *ServerDB::db = NULL;
Timer ServerDB::tLogClean;
QString ServerDB::qsUpgradeSuffix;

void ServerDB::loadOrSetupMetaPKBDF2IterationsCount(QSqlQuery &query) {
void ServerDB::loadOrSetupMetaPBKDF2IterationCount(QSqlQuery &query) {
if (!Meta::mp.legacyPasswordHash) {
if (Meta::mp.kdfIterations <= 0) {
// Configuration doesn't specify an override, load from db

SQLDO("SELECT `value` FROM `%1meta` WHERE `keystring` = 'pbkdf2_iterations'");
if (query.next()) {
Meta::mp.kdfIterations = query.value(0).toInt();
}

if (Meta::mp.kdfIterations <= 0) {
// Didn't get a valid iteration count from DB, overwrite
Meta::mp.kdfIterations = PBKDF2::benchmark();
qWarning() << "Performed initial PBKDF2 benchmark. Will use " << Meta::mp.kdfIterations << " iterations as default";

qWarning() << "Performed initial PBKDF2 benchmark. Will use" << Meta::mp.kdfIterations << "iterations as default";

SQLPREP("INSERT INTO `%1meta` (`keystring`, `value`) VALUES('pbkdf2_iterations',?)");
query.addBindValue(Meta::mp.kdfIterations);
SQLEXEC();
}
}

if (Meta::mp.kdfIterations < PBKDF2::BENCHMARK_MINIMUM_ITERATION_COUNT) {
qWarning() << "Configured default PBKDF2 iteration count of " << Meta::mp.kdfIterations << " is below minimum recommended value of " << PBKDF2::BENCHMARK_MINIMUM_ITERATION_COUNT << " and could be insecure.";
qWarning() << "Configured default PBKDF2 iteration count of" << Meta::mp.kdfIterations << "is below minimum recommended value of" << PBKDF2::BENCHMARK_MINIMUM_ITERATION_COUNT << "and could be insecure.";
}
}
}
}

ServerDB::ServerDB() {
@@ -212,8 +212,8 @@ ServerDB::ServerDB() {

if (query.next())
version = query.value(0).toInt();
loadOrSetupMetaPKBDF2IterationsCount(query);

loadOrSetupMetaPBKDF2IterationCount(query);

if (version < 6) {
if (version > 0) {
@@ -48,7 +48,7 @@ class ServerDB {
ServerDB(const ServerDB &);

private:
static void loadOrSetupMetaPKBDF2IterationsCount(QSqlQuery &query);
static void loadOrSetupMetaPBKDF2IterationCount(QSqlQuery &query);
static void writeSUPW(int srvnum, const QString &pwHash, const QString &saltHash, const QVariant &kdfIterations);
};

0 comments on commit 15072a4

Please sign in to comment.
You can’t perform that action at this time.