diff --git a/src/DataExporter.cpp b/src/DataExporter.cpp index 9854fa0613ee957a8921ae21dc075deda420f6fd..27f7f44368ae0fe57da897734d48e2ae45d04106 100644 --- a/src/DataExporter.cpp +++ b/src/DataExporter.cpp @@ -610,7 +610,7 @@ void DataExporter::importExportedTables(std::vector<std::string>& exportedTables { 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; errorStream << "ExportedTables property has invalid key at " @@ -619,8 +619,25 @@ void DataExporter::importExportedTables(std::vector<std::string>& exportedTables } 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); + 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 " << schema << " table " << table << endl; @@ -641,7 +658,7 @@ void DataExporter::importAuthorisedUsers(std::vector<std::string>& authorisedUse { 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; errorStream << "AuthorisedUsers property has invalid key at " @@ -650,8 +667,25 @@ void DataExporter::importAuthorisedUsers(std::vector<std::string>& authorisedUse } 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); + 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 INFO_STREAM << "DataExporter::importAuthorisedUsers() user " << user << " password " << password << endl; diff --git a/src/DataExporter.h b/src/DataExporter.h index bf46ce2e2556e7315a3403dfbfd580afca37470d..633a03749da9e4b92f5d3ec70cd4a6fd5deb533b 100644 --- a/src/DataExporter.h +++ b/src/DataExporter.h @@ -79,11 +79,11 @@ class DataExporter : public TANGO_BASE_CLASS //Max number of worker thread allowed static const unsigned int MAX_WORKER_NUMBER = 100; - //Max number of database connection allowed - static const unsigned int MAX_DB_CONNECTION_NUMBER = 100; - - //Max database port number allowed value - static const unsigned int MAX_DB_PORT = 65535; +// //Max number of database connection allowed +// static const unsigned int MAX_DB_CONNECTION_NUMBER = 100; +// +// //Max database port number allowed value +// static const unsigned int MAX_DB_PORT = 65535; /*----- PROTECTED REGION END -----*/ // DataExporter::Data Members