Skip to content
Permalink
Browse files

Merge pull request #2842 from jef-n/pg-new-sslmodes

postgres provider: add support for verify-ca and verify-full ssl modes (refs #14366)
  • Loading branch information
jef-n committed Feb 26, 2016
2 parents 5b7cfbc + 31e43a9 commit ee4658e3c6f63f3a9651134b172a0def224f01ca
@@ -14,7 +14,7 @@ class QgsDataSourceURI
%End

public:
enum SSLmode { SSLprefer, SSLdisable, SSLallow, SSLrequire };
enum SSLmode { SSLprefer, SSLdisable, SSLallow, SSLrequire, SSLverifyCA };

//! default constructor
QgsDataSourceURI();
@@ -199,6 +199,10 @@ QgsDataSourceURI::QgsDataSourceURI( QString uri )
mSSLmode = SSLprefer;
else if ( pval == "require" )
mSSLmode = SSLrequire;
else if ( pval == "verify-ca" )
mSSLmode = SSLverifyCA;
else if ( pval == "verify-full" )
mSSLmode = SSLverifyFull;
}
else if ( pname == "requiressl" )
{
@@ -499,9 +503,13 @@ QString QgsDataSourceURI::connectionInfo( bool expandAuthConfig ) const
else if ( mSSLmode == SSLrequire )
connectionItems << "sslmode=require";
#if 0
else if ( mSSLmode == SSLprefer )
else if ( mSSLmode == SSLprefer ) // no need to output the default
connectionItems << "sslmode=prefer";
#endif
else if ( mSSLmode == SSLverifyCA )
connectionItems << "sslmode=verify-ca";
else if ( mSSLmode == SSLverifyFull )
connectionItems << "sslmode=verify-full";

if ( !mAuthConfigId.isEmpty() )
{
@@ -35,7 +35,7 @@
class CORE_EXPORT QgsDataSourceURI
{
public:
enum SSLmode { SSLprefer, SSLdisable, SSLallow, SSLrequire };
enum SSLmode { SSLprefer, SSLdisable, SSLallow, SSLrequire, SSLverifyCA, SSLverifyFull };

//! default constructor
QgsDataSourceURI();
@@ -35,6 +35,8 @@ QgsPgNewConnection::QgsPgNewConnection( QWidget *parent, const QString& connName
cbxSSLmode->addItem( tr( "allow" ), QgsDataSourceURI::SSLallow );
cbxSSLmode->addItem( tr( "prefer" ), QgsDataSourceURI::SSLprefer );
cbxSSLmode->addItem( tr( "require" ), QgsDataSourceURI::SSLrequire );
cbxSSLmode->addItem( tr( "verify-ca" ), QgsDataSourceURI::SSLverifyCA );
cbxSSLmode->addItem( tr( "verify-full" ), QgsDataSourceURI::SSLverifyFull );

mAuthConfigSelect = new QgsAuthConfigSelect( this, "postgres" );
tabAuthentication->insertTab( 1, mAuthConfigSelect, tr( "Configurations" ) );

0 comments on commit ee4658e

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