Skip to content

Commit

Permalink
do not print SiStrip O2O passwords in clear
Browse files Browse the repository at this point in the history
  • Loading branch information
mmusich committed May 31, 2021
1 parent c5312c5 commit 5127989
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions OnlineDB/SiStripConfigDb/src/SiStripConfigDb.cc
Expand Up @@ -229,21 +229,22 @@ void SiStripConfigDb::usingDatabase() {
// Retrieve connection params from CONFDB env. var. and override .cfg values
std::string user = "";
std::string passwd = "";
std::string pToPrint = "******";
std::string path = "";
DbAccess::getDbConfiguration( user, passwd, path );
if ( !user.empty() && !passwd.empty() && !path.empty() ) {

std::stringstream ss;
ss << "[SiStripConfigDb::" << __func__ << "]"
<< " Setting \"user/passwd@path\" to \""
<< user << "/" << passwd << "@" << path
<< user << "/" << pToPrint << "@" << path
<< "\" using 'CONFDB' environmental variable";
if ( dbParams_.user() != null_ ||
dbParams_.passwd() != null_ ||
dbParams_.path() != null_ ) {
ss << " (Overwriting existing value of \""
<< dbParams_.user() << "/"
<< dbParams_.passwd() << "@"
<< pToPrint << "@"
<< dbParams_.path()
<< "\" read from .cfg file)";
}
Expand All @@ -258,7 +259,7 @@ void SiStripConfigDb::usingDatabase() {
ss << "[SiStripConfigDb::" << __func__ << "]"
<< " Setting \"user/passwd@path\" to \""
<< dbParams_.user() << "/"
<< dbParams_.passwd() << "@"
<< pToPrint << "@"
<< dbParams_.path()
<< "\" using 'ConfDb' configurable read from .cfg file";
edm::LogVerbatim(mlConfigDb_) << ss.str();
Expand All @@ -270,7 +271,7 @@ void SiStripConfigDb::usingDatabase() {
<< " from 'CONFDB' environmental variable or .cfg file"
<< " (present value is \""
<< user << "/"
<< passwd << "@"
<< pToPrint << "@"
<< path
<< "\"). Aborting connection to database...";
return;
Expand Down Expand Up @@ -359,7 +360,7 @@ void SiStripConfigDb::usingDatabase() {
std::stringstream ss;
ss << "Failed to connect to database using parameters '"
<< dbParams_.user() << "/"
<< dbParams_.passwd() << "@"
<< pToPrint << "@"
<< dbParams_.path()
<< "' and partitions '"
<< dbParams_.partitionNames( dbParams_.partitionNames() ) << "'";
Expand All @@ -375,7 +376,7 @@ void SiStripConfigDb::usingDatabase() {
<< std::hex << std::setw(8) << std::setfill('0') << factory_ << std::dec
<< ", using database account with parameters '"
<< dbParams_.user() << "/"
<< dbParams_.passwd() << "@"
<< pToPrint << "@"
<< dbParams_.path();
LogTrace(mlConfigDb_) << ss.str();
} else {
Expand All @@ -384,7 +385,7 @@ void SiStripConfigDb::usingDatabase() {
<< " NULL pointer to DeviceFactory!"
<< " Unable to connect to database using connection parameters '"
<< dbParams_.user() << "/"
<< dbParams_.passwd() << "@"
<< pToPrint << "@"
<< dbParams_.path()
<< "' and partitions '"
<< dbParams_.partitionNames( dbParams_.partitionNames() ) << "'";
Expand Down

0 comments on commit 5127989

Please sign in to comment.