Skip to content
Permalink
Browse files

Merge pull request #2686 from SebDieBln/FixPostgresWarnings

[Postgres] Remove the temporary SSL files only when they were created
  • Loading branch information
jef-n committed Jan 17, 2016
2 parents f966c42 + ed80951 commit 6435a20b3385736d1121a0e8fd24db0d03fc02f9
Showing with 12 additions and 12 deletions.
  1. +12 −12 src/providers/postgres/qgspostgresconn.cpp
@@ -208,19 +208,19 @@ QgsPostgresConn::QgsPostgresConn( const QString& conninfo, bool readOnly, bool s

mConn = PQconnectdb( expandedConnectionInfo.toLocal8Bit() ); // use what is set based on locale; after connecting, use Utf8

// remove temporary cert/key/CA
// remove temporary cert/key/CA if they exist
QgsDataSourceURI expandedUri( expandedConnectionInfo );
QString sslCertFile = expandedUri.param( "sslcert" );
sslCertFile.remove( "'" );
QFile::remove( sslCertFile );

QString sslKeyFile = expandedUri.param( "sslkey" );
sslKeyFile.remove( "'" );
QFile::remove( sslKeyFile );

QString sslCAFile = expandedUri.param( "sslrootcert" );
sslCAFile.remove( "'" );
QFile::remove( sslCAFile );
QStringList parameters;
parameters << "sslcert" << "sslkey" << "sslrootcert";
Q_FOREACH ( const QString& param, parameters )
{
if ( expandedUri.hasParam( param ) )
{
QString fileName = expandedUri.param( param );
fileName.remove( "'" );
QFile::remove( fileName );
}
}

// check the connection status
if ( PQstatus() != CONNECTION_OK )

1 comment on commit 6435a20

@luipir

This comment has been minimized.

Copy link
Contributor

@luipir luipir commented on 6435a20 Jan 17, 2016

good catch... thank you

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