1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00
This commit is contained in:
david hill
2017-10-19 11:34:55 -05:00
parent d4f49a5014
commit c2eab3b506
2 changed files with 9 additions and 3 deletions

View File

@ -8729,6 +8729,8 @@ namespace oam
******************************************************************************************/
std::string Oam::getMySQLPassword()
{
string mysqlUser = "root";
string USER = "root";
char* p= getenv("USER");
if (p && *p)
@ -8757,8 +8759,8 @@ namespace oam
while (file.getline(line, 400))
{
buf = line;
//find the mariadb user, root
string::size_type pos = buf.find("root",0);
string::size_type pos = buf.find(mysqlUser,0);
if (pos != string::npos)
{
file.getline(line, 400);
@ -8771,12 +8773,15 @@ namespace oam
if (pos1 != string::npos) {
//password found
string password = buf.substr(pos1+2, 80);
string password = buf.substr(pos1+1, 80);
password.erase(remove_if(password.begin(), password.end(), ::isspace), password.end());
writeLog("getMySQLPassword: password found", LOG_TYPE_DEBUG);
return password;
}
}
break;
}
}
file.close();

View File

@ -33,6 +33,7 @@
#include <limits.h>
#include <sstream>
#include <vector>
#include <algorithm>
#ifdef __linux__
#include <sys/sysinfo.h>
#include <netdb.h>