Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not print SiStrip O2O passwords in clear [11.1.X] #33906

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions OnlineDB/SiStripConfigDb/src/SiStripConfigDb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,32 +226,33 @@ 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
<< " Setting \"user/passwd@path\" to \"" << 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() << "@"
<< dbParams_.path() << "\" read from .cfg file)";
ss << " (Overwriting existing value of \"" << dbParams_.user() << "/" << pToPrint << "@" << dbParams_.path()
<< "\" read from .cfg file)";
}
edm::LogVerbatim(mlConfigDb_) << ss.str() << std::endl;
dbParams_.confdb(user, passwd, path);

} else if (dbParams_.user() != null_ && dbParams_.passwd() != null_ && dbParams_.path() != null_) {
std::stringstream ss;
ss << "[SiStripConfigDb::" << __func__ << "]"
<< " Setting \"user/passwd@path\" to \"" << dbParams_.user() << "/" << dbParams_.passwd() << "@"
<< dbParams_.path() << "\" using 'ConfDb' configurable read from .cfg file";
<< " Setting \"user/passwd@path\" to \"" << dbParams_.user() << "/" << pToPrint << "@" << dbParams_.path()
<< "\" using 'ConfDb' configurable read from .cfg file";
edm::LogVerbatim(mlConfigDb_) << ss.str();

} else {
edm::LogWarning(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
<< " Unable to retrieve 'user/passwd@path' parameters"
<< " from 'CONFDB' environmental variable or .cfg file"
<< " (present value is \"" << user << "/" << passwd << "@" << path
<< " (present value is \"" << user << "/" << pToPrint << "@" << path
<< "\"). Aborting connection to database...";
return;
}
Expand Down Expand Up @@ -327,7 +328,7 @@ void SiStripConfigDb::usingDatabase() {
<< " Created DeviceFactory object!";
} catch (...) {
std::stringstream ss;
ss << "Failed to connect to database using parameters '" << dbParams_.user() << "/" << dbParams_.passwd() << "@"
ss << "Failed to connect to database using parameters '" << dbParams_.user() << "/" << pToPrint << "@"
<< dbParams_.path() << "' and partitions '" << dbParams_.partitionNames(dbParams_.partitionNames()) << "'";
handleException(__func__, ss.str());
return;
Expand All @@ -338,14 +339,14 @@ void SiStripConfigDb::usingDatabase() {
std::stringstream ss;
ss << "[SiStripConfigDb::" << __func__ << "]"
<< " DeviceFactory created at address 0x" << std::hex << std::setw(8) << std::setfill('0') << factory_
<< std::dec << ", using database account with parameters '" << dbParams_.user() << "/" << dbParams_.passwd()
<< "@" << dbParams_.path();
<< std::dec << ", using database account with parameters '" << dbParams_.user() << "/" << pToPrint << "@"
<< dbParams_.path();
LogTrace(mlConfigDb_) << ss.str();
} else {
edm::LogError(mlConfigDb_) << "[SiStripConfigDb::" << __func__ << "]"
<< " NULL pointer to DeviceFactory!"
<< " Unable to connect to database using connection parameters '" << dbParams_.user()
<< "/" << dbParams_.passwd() << "@" << dbParams_.path() << "' and partitions '"
<< "/" << pToPrint << "@" << dbParams_.path() << "' and partitions '"
<< dbParams_.partitionNames(dbParams_.partitionNames()) << "'";
return;
}
Expand Down