mirror of
https://github.com/openappsec/openappsec.git
synced 2025-09-30 03:34:26 +03:00
central nginx manager
This commit is contained in:
@@ -49,6 +49,10 @@ public:
|
||||
}
|
||||
|
||||
virtual bool addGetCall(const std::string &uri, const std::function<std::string()> &callback) = 0;
|
||||
virtual bool addWildcardGetCall(
|
||||
const std::string &uri,
|
||||
const std::function<std::string(const std::string &)> &callback
|
||||
) = 0;
|
||||
|
||||
virtual uint16_t getListeningPort() const = 0;
|
||||
|
||||
|
@@ -10,6 +10,11 @@ class MockRestApi : public Singleton::Provide<I_RestApi>::From<MockProvider<I_Re
|
||||
public:
|
||||
MOCK_CONST_METHOD0(getListeningPort, uint16_t());
|
||||
MOCK_METHOD2(addGetCall, bool(const std::string &, const std::function<std::string()> &));
|
||||
MOCK_METHOD2(
|
||||
addWildcardGetCall,
|
||||
bool(const std::string &, const std::function<std::string(const std::string &)> &)
|
||||
);
|
||||
|
||||
// You can't mock a function with an R-value reference. So mock a slightly different one
|
||||
MOCK_METHOD3(mockRestCall, bool(RestAction, const std::string &, const std::unique_ptr<RestInit> &));
|
||||
|
||||
|
@@ -114,6 +114,7 @@ DEFINE_FLAG(D_COMPONENT, D_ALL)
|
||||
DEFINE_FLAG(D_FILE_UPLOAD, D_COMPONENT)
|
||||
DEFINE_FLAG(D_RATE_LIMIT, D_COMPONENT)
|
||||
DEFINE_FLAG(D_ROLLBACK_TESTING, D_COMPONENT)
|
||||
DEFINE_FLAG(D_NGINX_MANAGER, D_COMPONENT)
|
||||
|
||||
DEFINE_FLAG(D_PARSER, D_COMPONENT)
|
||||
DEFINE_FLAG(D_WS, D_COMPONENT)
|
||||
|
@@ -162,7 +162,7 @@ class LogField : Singleton::Consume<I_Environment>
|
||||
void
|
||||
addFields(const LogField &)
|
||||
{
|
||||
dbgAssert(false)
|
||||
dbgAssertOpt(false)
|
||||
<< AlertInfo(AlertTeam::CORE, "report i/s")
|
||||
<< "Trying to add a log field to a 'type'ed field";
|
||||
}
|
||||
|
@@ -26,7 +26,10 @@ public:
|
||||
void
|
||||
setBulkSize(uint size)
|
||||
{
|
||||
dbgAssert(size > 0) << AlertInfo(AlertTeam::CORE, "report i/s") << "Bulk size must be larger than 0";
|
||||
if (size <= 0) {
|
||||
dbgAssertOpt(size > 0) << AlertInfo(AlertTeam::CORE, "report i/s") << "Bulk size must be larger than 0";
|
||||
size = 100;
|
||||
}
|
||||
dbgDebug(D_REPORT_BULK) << "Bulk size is set to " << size;
|
||||
bulk_size = size;
|
||||
}
|
||||
|
@@ -33,6 +33,7 @@ bool makeDir(const std::string &path, mode_t permission = S_IRWXU);
|
||||
bool makeDirRecursive(const std::string &path, mode_t permission = S_IRWXU);
|
||||
bool deleteDirectory(const std::string &path, bool delete_content = false);
|
||||
bool touchFile(const std::string &path);
|
||||
std::string resolveFullPath(const std::string &input_path);
|
||||
|
||||
bool
|
||||
copyFile(
|
||||
@@ -43,11 +44,8 @@ copyFile(
|
||||
);
|
||||
|
||||
bool deleteFile(const std::string &path);
|
||||
|
||||
std::string convertToHumanReadable(uint64_t size_in_bytes);
|
||||
|
||||
std::string getFileName(const std::string &path);
|
||||
|
||||
bool copyDirectory(const std::string &src_dir_path, const std::string &dst_dir_path);
|
||||
|
||||
}// namespace Filesystem
|
||||
@@ -85,6 +83,8 @@ namespace Strings
|
||||
{
|
||||
|
||||
std::string removeTrailingWhitespaces(std::string str);
|
||||
std::string removeLeadingWhitespaces(std::string str);
|
||||
std::string trim(std::string str);
|
||||
|
||||
} // namespace Strings
|
||||
|
||||
|
@@ -87,9 +87,12 @@ public:
|
||||
bool
|
||||
operator==(const IPAddr &other) const
|
||||
{
|
||||
dbgAssert(type!=IPType::UNINITIALIZED && other.type!=IPType::UNINITIALIZED)
|
||||
<< AlertInfo(AlertTeam::CORE, "connkey")
|
||||
<< "Called on an uninitialized IPType object";
|
||||
if (type == IPType::UNINITIALIZED || other.type == IPType::UNINITIALIZED) {
|
||||
dbgAssertOpt(type!=IPType::UNINITIALIZED && other.type!=IPType::UNINITIALIZED)
|
||||
<< AlertInfo(AlertTeam::CORE, "connkey")
|
||||
<< "Called on an uninitialized IPType object";
|
||||
return false;
|
||||
}
|
||||
// Always compairing as if IPv6, in case of Ipv4 the rest of the address is zeroed out.
|
||||
int ip_len = (other.type == IPType::V4) ? sizeof(v4.s_addr) : sizeof(v6.s6_addr);
|
||||
return (type == other.type) && (memcmp(v6.s6_addr, other.v6.s6_addr, ip_len) == 0);
|
||||
@@ -308,9 +311,12 @@ public:
|
||||
IPType
|
||||
getType() const
|
||||
{
|
||||
dbgAssert(src.type == dst.type)
|
||||
<< AlertInfo(AlertTeam::CORE, "connkey")
|
||||
<< "Mismatch in connection types (Src and Dst types are not identical)";
|
||||
if (src.type != dst.type) {
|
||||
dbgAssertOpt(src.type == dst.type)
|
||||
<< AlertInfo(AlertTeam::CORE, "connkey")
|
||||
<< "Mismatch in connection types (Src and Dst types are not identical)";
|
||||
return IPType::V6;
|
||||
}
|
||||
return src.type;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user