Skip to content

Commit

Permalink
Merge PR #2891: ServerDB: use PasswordGenerator class for generating …
Browse files Browse the repository at this point in the history
…initial SuperUser password.
  • Loading branch information
mkrautz committed Mar 2, 2017
2 parents b046d6f + 218eb18 commit 9ae2a7f
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/murmur/ServerDB.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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));
}
Expand Down

0 comments on commit 9ae2a7f

Please sign in to comment.