Commit 6391ff2f authored by Marco De Marco's avatar Marco De Marco
Browse files

Empty schema table user password check added

parent 62270bca
Loading
Loading
Loading
Loading
+36 −2
Original line number Diff line number Diff line
@@ -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;
+5 −5
Original line number Diff line number Diff line
@@ -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