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 048d1ad commit 845c5870f7a973cf61486ff23494a069fca8d9b2
Showing with 3 additions and 3 deletions.
  1. +2 −3 src/core/auth/qgsauthmanager.cpp
  2. +1 −0 src/core/auth/qgsauthmanager.h
@@ -99,6 +99,7 @@ QgsAuthManager *QgsAuthManager::instance()
QgsAuthManager::QgsAuthManager()
{
mMutex = new QMutex( QMutex::Recursive );
mMasterPasswordMutex = new QMutex( QMutex::Recursive );
connect( this, &QgsAuthManager::messageOut,
this, &QgsAuthManager::writeToConsole );
}
@@ -487,7 +488,7 @@ const QString QgsAuthManager::disabledMessage() const

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

@@ -497,13 +498,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 845c587

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