From: Peter van Dijk Date: Wed, 9 May 2012 10:41:52 +0000 (+0000) Subject: stop logging postgres database password in gpgsql connection errors. Fixes #459,... X-Git-Tag: auth-3.2-rc1~253 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e310897f9f85aa16d6e9730a54b0cc368cb2e5ce;p=pdns stop logging postgres database password in gpgsql connection errors. Fixes #459, reported by Stefan Kaltenbrunner. git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@2609 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/modules/gpgsqlbackend/spgsql.cc b/modules/gpgsqlbackend/spgsql.cc index 65ea61610..2554e1a88 100644 --- a/modules/gpgsqlbackend/spgsql.cc +++ b/modules/gpgsqlbackend/spgsql.cc @@ -26,8 +26,12 @@ SPgSQL::SPgSQL(const string &database, const string &host, const string& port, c if(!port.empty()) d_connectstr+=" port="+port; - if(!password.empty()) + d_connectlogstr=d_connectstr; + + if(!password.empty()) { + d_connectlogstr+=" password=XXX"; d_connectstr+=" password="+password; + } ensureConnect(); } @@ -55,7 +59,7 @@ void SPgSQL::ensureConnect() if (!d_db || PQstatus(d_db)==CONNECTION_BAD) { try { - throw sPerrorException("Unable to connect to database, connect string: "+d_connectstr); + throw sPerrorException("Unable to connect to database, connect string: "+d_connectlogstr); } catch(...) { if(d_db) diff --git a/modules/gpgsqlbackend/spgsql.hh b/modules/gpgsqlbackend/spgsql.hh index 3cca2310f..796a9231f 100644 --- a/modules/gpgsqlbackend/spgsql.hh +++ b/modules/gpgsqlbackend/spgsql.hh @@ -26,6 +26,7 @@ private: void ensureConnect(); PGconn* d_db; string d_connectstr; + string d_connectlogstr; PGresult* d_result; int d_count; static bool s_dolog;