Skip to content
Snippets Groups Projects
Commit 6391ff2f authored by Marco De Marco's avatar Marco De Marco
Browse files

Empty schema table user password check added

parent 62270bca
No related branches found
No related tags found
No related merge requests found
...@@ -610,7 +610,7 @@ void DataExporter::importExportedTables(std::vector<std::string>& exportedTables ...@@ -610,7 +610,7 @@ void DataExporter::importExportedTables(std::vector<std::string>& exportedTables
{ {
std::size_t found; std::size_t found;
if((found=exportedTables.at(i).find(' ')) == std::string::npos) if((found=exportedTables.at(i).find(',')) == std::string::npos)
{ {
std::stringstream errorStream; std::stringstream errorStream;
errorStream << "ExportedTables property has invalid key at " errorStream << "ExportedTables property has invalid key at "
...@@ -619,8 +619,25 @@ void DataExporter::importExportedTables(std::vector<std::string>& exportedTables ...@@ -619,8 +619,25 @@ void DataExporter::importExportedTables(std::vector<std::string>& exportedTables
} }
std::string schema = exportedTables.at(i).substr(0, found); std::string schema = exportedTables.at(i).substr(0, found);
if(schema.empty())
{
std::stringstream errorStream;
errorStream << "ExportedTables property has empty schema at "
<< i << " position" << std::endl;
throw std::invalid_argument(errorStream.str());
}
std::string table = exportedTables.at(i).substr(found+1, std::string::npos); std::string table = exportedTables.at(i).substr(found+1, std::string::npos);
if(table.empty())
{
std::stringstream errorStream;
errorStream << "ExportedTables property has empty table at "
<< i << " position" << std::endl;
throw std::invalid_argument(errorStream.str());
}
INFO_STREAM << "DataExporter::importExportedTables() schema " INFO_STREAM << "DataExporter::importExportedTables() schema "
<< schema << " table " << table << endl; << schema << " table " << table << endl;
...@@ -641,7 +658,7 @@ void DataExporter::importAuthorisedUsers(std::vector<std::string>& authorisedUse ...@@ -641,7 +658,7 @@ void DataExporter::importAuthorisedUsers(std::vector<std::string>& authorisedUse
{ {
std::size_t found; std::size_t found;
if((found=authorisedUsers.at(i).find(' ')) == std::string::npos) if((found=authorisedUsers.at(i).find(',')) == std::string::npos)
{ {
std::stringstream errorStream; std::stringstream errorStream;
errorStream << "AuthorisedUsers property has invalid key at " errorStream << "AuthorisedUsers property has invalid key at "
...@@ -650,8 +667,25 @@ void DataExporter::importAuthorisedUsers(std::vector<std::string>& authorisedUse ...@@ -650,8 +667,25 @@ void DataExporter::importAuthorisedUsers(std::vector<std::string>& authorisedUse
} }
std::string user = authorisedUsers.at(i).substr(0, found); std::string user = authorisedUsers.at(i).substr(0, found);
if(user.empty())
{
std::stringstream errorStream;
errorStream << "AuthorisedUsers property has empty user at "
<< i << " position" << std::endl;
throw std::invalid_argument(errorStream.str());
}
std::string password = authorisedUsers.at(i).substr(found+1, std::string::npos); std::string password = authorisedUsers.at(i).substr(found+1, std::string::npos);
if(password.empty())
{
std::stringstream errorStream;
errorStream << "AuthorisedUsers property has empty password at "
<< i << " position" << std::endl;
throw std::invalid_argument(errorStream.str());
}
#ifdef VERBOSE_DEBUG #ifdef VERBOSE_DEBUG
INFO_STREAM << "DataExporter::importAuthorisedUsers() user " INFO_STREAM << "DataExporter::importAuthorisedUsers() user "
<< user << " password " << password << endl; << user << " password " << password << endl;
......
...@@ -79,11 +79,11 @@ class DataExporter : public TANGO_BASE_CLASS ...@@ -79,11 +79,11 @@ class DataExporter : public TANGO_BASE_CLASS
//Max number of worker thread allowed //Max number of worker thread allowed
static const unsigned int MAX_WORKER_NUMBER = 100; static const unsigned int MAX_WORKER_NUMBER = 100;
//Max number of database connection allowed // //Max number of database connection allowed
static const unsigned int MAX_DB_CONNECTION_NUMBER = 100; // static const unsigned int MAX_DB_CONNECTION_NUMBER = 100;
//
//Max database port number allowed value // //Max database port number allowed value
static const unsigned int MAX_DB_PORT = 65535; // static const unsigned int MAX_DB_PORT = 65535;
/*----- PROTECTED REGION END -----*/ // DataExporter::Data Members /*----- PROTECTED REGION END -----*/ // DataExporter::Data Members
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment