Skip to content
Permalink
Browse files

[authentication manager] Use dedicated mutex for master password check

  • Loading branch information
nirvn authored and nyalldawson committed Apr 27, 2020
1 parent 17d5377 commit 0cf85766439fac86d2052754d981ee07b4c225dc
Showing with 3 additions and 3 deletions.
  1. +2 −3 src/core/auth/qgsauthmanager.cpp
  2. +1 −0 src/core/auth/qgsauthmanager.h
@@ -103,6 +103,7 @@ QgsAuthManager *QgsAuthManager::instance()
QgsAuthManager::QgsAuthManager()
{
mMutex = new QMutex( QMutex::Recursive );
mMasterPasswordMutex = new QMutex( QMutex::Recursive );
connect( this, &QgsAuthManager::messageOut,
this, &QgsAuthManager::writeToConsole );
}
@@ -491,7 +492,7 @@ const QString QgsAuthManager::disabledMessage() const

bool QgsAuthManager::setMasterPassword( bool verify )
{
QMutexLocker locker( mMutex );
QMutexLocker locker( mMasterPasswordMutex );
if ( isDisabled() )
return false;

@@ -501,13 +502,11 @@ bool QgsAuthManager::setMasterPassword( bool verify )
if ( mMasterPass.isEmpty() )
{
QgsDebugMsg( QStringLiteral( "Master password is not yet set by user" ) );
locker.unlock();
if ( !masterPasswordInput() )
{
QgsDebugMsg( QStringLiteral( "Master password input canceled by user" ) );
return false;
}
locker.relock();
}
else
{
@@ -863,6 +863,7 @@ class CORE_EXPORT QgsAuthManager : public QObject
bool mScheduledDbEraseRequestEmitted = false;
int mScheduledDbEraseRequestCount = 0;
QMutex *mMutex = nullptr;
QMutex *mMasterPasswordMutex = nullptr;

#ifndef QT_NO_SSL
// mapping of sha1 digest and cert source and cert

0 comments on commit 0cf8576

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