Skip to content

Commit

Permalink
Insure that src/auth builds with QT_NO_SSL defined
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Mar 2, 2024
1 parent ccef0f2 commit 68cfeec
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/auth/identcert/core/qgsauthidentcertmethod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ const QString QgsAuthIdentCertMethod::AUTH_METHOD_KEY = QStringLiteral( "Identit
const QString QgsAuthIdentCertMethod::AUTH_METHOD_DESCRIPTION = QStringLiteral( "Identity certificate authentication" );
const QString QgsAuthIdentCertMethod::AUTH_METHOD_DISPLAY_DESCRIPTION = tr( "Identity certificate authentication" );

#ifndef QT_NO_SSL
QMap<QString, QgsPkiConfigBundle *> QgsAuthIdentCertMethod::sPkiConfigBundleCache = QMap<QString, QgsPkiConfigBundle *>();
#endif


QgsAuthIdentCertMethod::QgsAuthIdentCertMethod()
Expand All @@ -57,9 +59,11 @@ QgsAuthIdentCertMethod::QgsAuthIdentCertMethod()

QgsAuthIdentCertMethod::~QgsAuthIdentCertMethod()
{
#ifndef QT_NO_SSL
const QMutexLocker locker( &mMutex );
qDeleteAll( sPkiConfigBundleCache );
sPkiConfigBundleCache.clear();
#endif
}

QString QgsAuthIdentCertMethod::key() const
Expand All @@ -80,6 +84,7 @@ QString QgsAuthIdentCertMethod::displayDescription() const
bool QgsAuthIdentCertMethod::updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider )
{
#ifndef QT_NO_SSL
Q_UNUSED( dataprovider )
const QMutexLocker locker( &mMutex );

Expand Down Expand Up @@ -110,11 +115,15 @@ bool QgsAuthIdentCertMethod::updateNetworkRequest( QNetworkRequest &request, con
request.setSslConfiguration( sslConfig );

return true;
#else
return false;
#endif
}

bool QgsAuthIdentCertMethod::updateDataSourceUriItems( QStringList &connectionItems, const QString &authcfg,
const QString &dataprovider )
{
#ifndef QT_NO_SSL
Q_UNUSED( dataprovider )
const QMutexLocker locker( &mMutex );

Expand Down Expand Up @@ -210,6 +219,9 @@ bool QgsAuthIdentCertMethod::updateDataSourceUriItems( QStringList &connectionIt
}

return true;
#else
return false;
#endif
}

void QgsAuthIdentCertMethod::clearCachedConfig( const QString &authcfg )
Expand All @@ -232,6 +244,7 @@ void QgsAuthIdentCertMethod::updateMethodConfig( QgsAuthMethodConfig &mconfig )
// TODO: add updates as method version() increases due to config storage changes
}

#ifndef QT_NO_SSL
QgsPkiConfigBundle *QgsAuthIdentCertMethod::getPkiConfigBundle( const QString &authcfg )
{
const QMutexLocker locker( &mMutex );
Expand Down Expand Up @@ -303,6 +316,7 @@ void QgsAuthIdentCertMethod::removePkiConfigBundle( const QString &authcfg )
QgsDebugMsgLevel( QStringLiteral( "Removed PKI bundle for authcfg: %1" ).arg( authcfg ), 2 );
}
}
#endif

#ifdef HAVE_GUI
QWidget *QgsAuthIdentCertMethod::editWidget( QWidget *parent ) const
Expand Down
2 changes: 2 additions & 0 deletions src/auth/identcert/core/qgsauthidentcertmethod.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@ class QgsAuthIdentCertMethod : public QgsAuthMethod

private:

#ifndef QT_NO_SSL
QgsPkiConfigBundle *getPkiConfigBundle( const QString &authcfg );

void putPkiConfigBundle( const QString &authcfg, QgsPkiConfigBundle *pkibundle );

void removePkiConfigBundle( const QString &authcfg );

static QMap<QString, QgsPkiConfigBundle *> sPkiConfigBundleCache;
#endif

};

Expand Down
16 changes: 16 additions & 0 deletions src/auth/pkipaths/core/qgsauthpkipathsmethod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ const QString QgsAuthPkiPathsMethod::AUTH_METHOD_KEY = QStringLiteral( "PKI-Path
const QString QgsAuthPkiPathsMethod::AUTH_METHOD_DESCRIPTION = QStringLiteral( "PKI paths authentication" );
const QString QgsAuthPkiPathsMethod::AUTH_METHOD_DISPLAY_DESCRIPTION = tr( "PKI paths authentication" );

#ifndef QT_NO_SSL
QMap<QString, QgsPkiConfigBundle *> QgsAuthPkiPathsMethod::sPkiConfigBundleCache = QMap<QString, QgsPkiConfigBundle *>();
#endif


QgsAuthPkiPathsMethod::QgsAuthPkiPathsMethod()
Expand All @@ -56,9 +58,11 @@ QgsAuthPkiPathsMethod::QgsAuthPkiPathsMethod()

QgsAuthPkiPathsMethod::~QgsAuthPkiPathsMethod()
{
#ifndef QT_NO_SSL
const QMutexLocker locker( &mMutex );
qDeleteAll( sPkiConfigBundleCache );
sPkiConfigBundleCache.clear();
#endif
}

QString QgsAuthPkiPathsMethod::key() const
Expand All @@ -80,6 +84,7 @@ QString QgsAuthPkiPathsMethod::displayDescription() const
bool QgsAuthPkiPathsMethod::updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider )
{
#ifndef QT_NO_SSL
Q_UNUSED( dataprovider )
const QMutexLocker locker( &mMutex );

Expand Down Expand Up @@ -122,12 +127,16 @@ bool QgsAuthPkiPathsMethod::updateNetworkRequest( QNetworkRequest &request, cons
request.setSslConfiguration( sslConfig );

return true;
#else
return false;
#endif
}


bool QgsAuthPkiPathsMethod::updateDataSourceUriItems( QStringList &connectionItems, const QString &authcfg,
const QString &dataprovider )
{
#ifndef QT_NO_SSL
Q_UNUSED( dataprovider )
const QMutexLocker locker( &mMutex );

Expand Down Expand Up @@ -243,12 +252,17 @@ bool QgsAuthPkiPathsMethod::updateDataSourceUriItems( QStringList &connectionIte
}

return true;
#else
return false;
#endif
}

void QgsAuthPkiPathsMethod::clearCachedConfig( const QString &authcfg )
{
#ifndef QT_NO_SSL
const QMutexLocker locker( &mMutex );
removePkiConfigBundle( authcfg );
#endif
}

void QgsAuthPkiPathsMethod::updateMethodConfig( QgsAuthMethodConfig &mconfig )
Expand All @@ -268,6 +282,7 @@ void QgsAuthPkiPathsMethod::updateMethodConfig( QgsAuthMethodConfig &mconfig )
// TODO: add updates as method version() increases due to config storage changes
}

#ifndef QT_NO_SSL
QgsPkiConfigBundle *QgsAuthPkiPathsMethod::getPkiConfigBundle( const QString &authcfg )
{
const QMutexLocker locker( &mMutex );
Expand Down Expand Up @@ -337,6 +352,7 @@ void QgsAuthPkiPathsMethod::removePkiConfigBundle( const QString &authcfg )
QgsDebugMsgLevel( QStringLiteral( "Removed PKI bundle for authcfg: %1" ).arg( authcfg ), 2 );
}
}
#endif

#ifdef HAVE_GUI
QWidget *QgsAuthPkiPathsMethod::editWidget( QWidget *parent ) const
Expand Down
2 changes: 2 additions & 0 deletions src/auth/pkipaths/core/qgsauthpkipathsmethod.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@ class QgsAuthPkiPathsMethod : public QgsAuthMethod

private:

#ifndef QT_NO_SSL
QgsPkiConfigBundle *getPkiConfigBundle( const QString &authcfg );

void putPkiConfigBundle( const QString &authcfg, QgsPkiConfigBundle *pkibundle );

void removePkiConfigBundle( const QString &authcfg );

static QMap<QString, QgsPkiConfigBundle *> sPkiConfigBundleCache;
#endif

};

Expand Down
17 changes: 17 additions & 0 deletions src/auth/pkipkcs12/core/qgsauthpkcs12method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ const QString QgsAuthPkcs12Method::AUTH_METHOD_KEY = QStringLiteral( "PKI-PKCS#1
const QString QgsAuthPkcs12Method::AUTH_METHOD_DESCRIPTION = QStringLiteral( "PKI PKCS#12 authentication" );
const QString QgsAuthPkcs12Method::AUTH_METHOD_DISPLAY_DESCRIPTION = tr( "PKI PKCS#12 authentication" );

#ifndef QT_NO_SSL
QMap<QString, QgsPkiConfigBundle *> QgsAuthPkcs12Method::sPkiConfigBundleCache = QMap<QString, QgsPkiConfigBundle *>();
#endif


QgsAuthPkcs12Method::QgsAuthPkcs12Method()
Expand All @@ -56,8 +58,10 @@ QgsAuthPkcs12Method::QgsAuthPkcs12Method()

QgsAuthPkcs12Method::~QgsAuthPkcs12Method()
{
#ifndef QT_NO_SSL
qDeleteAll( sPkiConfigBundleCache );
sPkiConfigBundleCache.clear();
#endif
}

QString QgsAuthPkcs12Method::key() const
Expand All @@ -78,6 +82,7 @@ QString QgsAuthPkcs12Method::displayDescription() const
bool QgsAuthPkcs12Method::updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider )
{
#ifndef QT_NO_SSL
Q_UNUSED( dataprovider )
const QMutexLocker locker( &mMutex );

Expand Down Expand Up @@ -121,11 +126,15 @@ bool QgsAuthPkcs12Method::updateNetworkRequest( QNetworkRequest &request, const
request.setSslConfiguration( sslConfig );

return true;
#else
return false;
#endif
}

bool QgsAuthPkcs12Method::updateDataSourceUriItems( QStringList &connectionItems, const QString &authcfg,
const QString &dataprovider )
{
#ifndef QT_NO_SSL
Q_UNUSED( dataprovider )
const QMutexLocker locker( &mMutex );

Expand All @@ -137,6 +146,7 @@ bool QgsAuthPkcs12Method::updateDataSourceUriItems( QStringList &connectionItems
QgsDebugError( QStringLiteral( "Update URI items FAILED: PKI bundle invalid" ) );
return false;
}

QgsDebugMsgLevel( QStringLiteral( "Update URI items: PKI bundle valid" ), 2 );

const QString pkiTempFileBase = QStringLiteral( "tmppki_%1.pem" );
Expand Down Expand Up @@ -241,12 +251,17 @@ bool QgsAuthPkcs12Method::updateDataSourceUriItems( QStringList &connectionItems
}

return true;
#else
return false;
#endif
}

void QgsAuthPkcs12Method::clearCachedConfig( const QString &authcfg )
{
#ifndef QT_NO_SSL
const QMutexLocker locker( &mMutex );
removePkiConfigBundle( authcfg );
#endif
}

void QgsAuthPkcs12Method::updateMethodConfig( QgsAuthMethodConfig &mconfig )
Expand All @@ -265,6 +280,7 @@ void QgsAuthPkcs12Method::updateMethodConfig( QgsAuthMethodConfig &mconfig )
// TODO: add updates as method version() increases due to config storage changes
}

#ifndef QT_NO_SSL
QgsPkiConfigBundle *QgsAuthPkcs12Method::getPkiConfigBundle( const QString &authcfg )
{
QMutexLocker locker( &mMutex );
Expand Down Expand Up @@ -357,6 +373,7 @@ void QgsAuthPkcs12Method::removePkiConfigBundle( const QString &authcfg )
QgsDebugMsgLevel( QStringLiteral( "Removed PKI bundle for authcfg: %1" ).arg( authcfg ), 2 );
}
}
#endif

#ifdef HAVE_GUI
QWidget *QgsAuthPkcs12Method::editWidget( QWidget *parent ) const
Expand Down
2 changes: 2 additions & 0 deletions src/auth/pkipkcs12/core/qgsauthpkcs12method.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,15 @@ class QgsAuthPkcs12Method : public QgsAuthMethod

private:

#ifndef QT_NO_SSL
QgsPkiConfigBundle *getPkiConfigBundle( const QString &authcfg );

void putPkiConfigBundle( const QString &authcfg, QgsPkiConfigBundle *pkibundle );

void removePkiConfigBundle( const QString &authcfg );

static QMap<QString, QgsPkiConfigBundle *> sPkiConfigBundleCache;
#endif

};

Expand Down

0 comments on commit 68cfeec

Please sign in to comment.