mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-10 00:13:55 -04:00
parent
8b83a461f9
commit
41650fcac2
@ -105,18 +105,28 @@ bool QgsAuthBasicMethod::updateDataSourceUriItems( QStringList &connectionItems,
|
||||
return false;
|
||||
}
|
||||
|
||||
QString sslMode = QStringLiteral( "prefer" );
|
||||
int sslModeIdx = connectionItems.indexOf( QRegExp( "^sslmode='.*" ) );
|
||||
if ( sslModeIdx != -1 )
|
||||
{
|
||||
sslMode = connectionItems.at( sslModeIdx ).split( '=' ).at( 1 );
|
||||
}
|
||||
|
||||
// SSL Extra CAs
|
||||
QString caparam;
|
||||
QList<QSslCertificate> cas;
|
||||
cas = QgsApplication::authManager()->trustedCaCerts();
|
||||
// save CAs to temp file
|
||||
QString tempFileBase = QStringLiteral( "tmp_basic_%1.pem" );
|
||||
QString caFilePath = QgsAuthCertUtils::pemTextToTempFile(
|
||||
tempFileBase.arg( QUuid::createUuid().toString() ),
|
||||
QgsAuthCertUtils::certsToPemText( cas ) );
|
||||
if ( ! caFilePath.isEmpty() )
|
||||
if ( sslMode.startsWith( QStringLiteral( "verify-" ) ) )
|
||||
{
|
||||
caparam = "sslrootcert='" + caFilePath + "'";
|
||||
cas = QgsApplication::authManager()->trustedCaCerts();
|
||||
// save CAs to temp file
|
||||
QString tempFileBase = QStringLiteral( "tmp_basic_%1.pem" );
|
||||
QString caFilePath = QgsAuthCertUtils::pemTextToTempFile(
|
||||
tempFileBase.arg( QUuid::createUuid().toString() ),
|
||||
QgsAuthCertUtils::certsToPemText( cas ) );
|
||||
if ( ! caFilePath.isEmpty() )
|
||||
{
|
||||
caparam = "sslrootcert='" + caFilePath + "'";
|
||||
}
|
||||
}
|
||||
|
||||
// Branch for OGR
|
||||
|
Loading…
x
Reference in New Issue
Block a user