Skip to content
Permalink
Browse files

Merge PR #2891: ServerDB: use PasswordGenerator class for generating …

…initial SuperUser password.
  • Loading branch information...
mkrautz committed Mar 2, 2017
2 parents b046d6f + 218eb18 commit 9ae2a7f59e2362912300b7ac7d65e3fdaf72385b
Showing with 3 additions and 7 deletions.
  1. +3 −7 src/murmur/ServerDB.cpp
@@ -17,6 +17,7 @@
#include "ServerUser.h"
#include "User.h"
#include "PBKDF2.h"
#include "PasswordGenerator.h"

#define SQLQUERY(x) ServerDB::query(query, QLatin1String(x), true)
#define SQLDO(x) ServerDB::exec(query, QLatin1String(x), true)
@@ -725,13 +726,8 @@ void Server::initialize() {
query.addBindValue(QLatin1String("SuperUser"));
SQLEXEC();

int length = qrand() % 8 + 8;
QString pw;
pw.reserve(length);

while (length--)
pw.append(QChar(qrand() % 94 + 33));

const int passwordLength = 12;
QString pw = PasswordGenerator::generatePassword(passwordLength);
ServerDB::setSUPW(iServerNum, pw);
log(QString("Password for 'SuperUser' set to '%2'").arg(pw));
}

0 comments on commit 9ae2a7f

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