diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-04-25 16:17:54 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-04-25 16:17:54 -0700 |
commit | 4e77365e8d8d49a7329d65b2d5f0508a7f12a097 (patch) | |
tree | 89ea01d2af9cb3339fc74790c8a951e351515f1f /controller/JSONDB.cpp | |
parent | 4f2a77976965f19640416afca24367d3037820b8 (diff) | |
download | infinitytier-4e77365e8d8d49a7329d65b2d5f0508a7f12a097.tar.gz infinitytier-4e77365e8d8d49a7329d65b2d5f0508a7f12a097.zip |
Remove a little cruft.
Diffstat (limited to 'controller/JSONDB.cpp')
-rw-r--r-- | controller/JSONDB.cpp | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/controller/JSONDB.cpp b/controller/JSONDB.cpp index 509250b9..1055b036 100644 --- a/controller/JSONDB.cpp +++ b/controller/JSONDB.cpp @@ -55,8 +55,6 @@ JSONDB::JSONDB(const std::string &basePath) : bool JSONDB::writeRaw(const std::string &n,const std::string &obj) { - if (!_isValidObjectName(n)) - return false; if (_httpAddr) { std::map<std::string,std::string> headers; std::string body; @@ -92,9 +90,6 @@ nlohmann::json JSONDB::get(const std::string &n) _reload(_basePath,std::string()); } - if (!_isValidObjectName(n)) - return _EMPTY_JSON; - { Mutex::Lock _l(_db_m); std::map<std::string,_E>::iterator e(_db.find(n)); @@ -131,8 +126,6 @@ nlohmann::json JSONDB::get(const std::string &n) void JSONDB::erase(const std::string &n) { - if (!_isValidObjectName(n)) - return; _erase(n); { Mutex::Lock _l(_db_m); @@ -190,20 +183,6 @@ void JSONDB::_reload(const std::string &p,const std::string &b) } } -bool JSONDB::_isValidObjectName(const std::string &n) -{ - if (n.length() == 0) - return false; - const char *p = n.c_str(); - char c; - // For security reasons we should not allow dots, backslashes, or other path characters or potential path characters. - while ((c = *(p++))) { - if (!( ((c >= 'a')&&(c <= 'z')) || ((c >= 'A')&&(c <= 'Z')) || ((c >= '0')&&(c <= '9')) || (c == '/') || (c == '_') || (c == '~') || (c == '-') )) - return false; - } - return true; -} - std::string JSONDB::_genPath(const std::string &n,bool create) { std::vector<std::string> pt(OSUtils::split(n.c_str(),"/","","")); |