mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 13:33:38 +02:00
allow case insensitivity for allowed users in domain-server
This commit is contained in:
parent
001587db27
commit
0348251cc1
2 changed files with 5 additions and 7 deletions
|
@ -637,7 +637,7 @@ bool DomainServer::shouldAllowConnectionFromNode(const QString& username,
|
|||
}
|
||||
|
||||
if (allowedUsers.count() > 0) {
|
||||
if (allowedUsers.contains(username)) {
|
||||
if (allowedUsers.contains(username, Qt::CaseInsensitive)) {
|
||||
// it's possible this user can be allowed to connect, but we need to check their username signature
|
||||
|
||||
QByteArray publicKeyArray = _userPublicKeys.value(username);
|
||||
|
@ -657,7 +657,7 @@ bool DomainServer::shouldAllowConnectionFromNode(const QString& username,
|
|||
rsaPublicKey, RSA_PKCS1_PADDING);
|
||||
|
||||
if (decryptResult != -1) {
|
||||
if (username == decryptedArray) {
|
||||
if (username.toLower() == decryptedArray) {
|
||||
qDebug() << "Username signature matches for" << username << "- allowing connection.";
|
||||
|
||||
// free up the public key before we return
|
||||
|
@ -1126,8 +1126,6 @@ void DomainServer::sendHeartbeatToDataServer(const QString& networkAddress) {
|
|||
|
||||
QString domainUpdateJSON = QString("{\"domain\": %1 }").arg(QString(QJsonDocument(domainObject).toJson()));
|
||||
|
||||
qDebug() << domainUpdateJSON;
|
||||
|
||||
AccountManager::getInstance().authenticatedRequest(DOMAIN_UPDATE.arg(uuidStringWithoutCurlyBraces(domainID)),
|
||||
QNetworkAccessManager::PutOperation,
|
||||
JSONCallbackParameters(),
|
||||
|
|
|
@ -130,11 +130,11 @@ const QByteArray& DataServerAccountInfo::getUsernameSignature() {
|
|||
reinterpret_cast<const unsigned char**>(&privateKeyData),
|
||||
_privateKey.size());
|
||||
if (rsaPrivateKey) {
|
||||
QByteArray usernameByteArray = _username.toUtf8();
|
||||
QByteArray lowercaseUsername = _username.toLower().toUtf8();
|
||||
_usernameSignature.resize(RSA_size(rsaPrivateKey));
|
||||
|
||||
int encryptReturn = RSA_private_encrypt(usernameByteArray.size(),
|
||||
reinterpret_cast<const unsigned char*>(usernameByteArray.constData()),
|
||||
int encryptReturn = RSA_private_encrypt(lowercaseUsername.size(),
|
||||
reinterpret_cast<const unsigned char*>(lowercaseUsername.constData()),
|
||||
reinterpret_cast<unsigned char*>(_usernameSignature.data()),
|
||||
rsaPrivateKey, RSA_PKCS1_PADDING);
|
||||
|
||||
|
|
Loading…
Reference in a new issue