mirror of
https://github.com/openappsec/openappsec.git
synced 2025-09-29 11:16:30 +03:00
Jul 5th update
This commit is contained in:
@@ -208,12 +208,14 @@ void ConfidenceCalculator::pullProcessedData(const std::vector<std::string>& fil
|
||||
{
|
||||
dbgTrace(D_WAAP) << "Fetching the confidence set object";
|
||||
bool is_first_pull = true;
|
||||
bool is_ok = false;
|
||||
for (auto file : files)
|
||||
{
|
||||
ConfidenceFileDecryptor getConfFile;
|
||||
bool res = sendObjectWithRetry(getConfFile,
|
||||
I_Messaging::Method::GET,
|
||||
getUri() + "/" + file);
|
||||
is_ok |= res;
|
||||
if (res && getConfFile.getConfidenceSet().ok())
|
||||
{
|
||||
mergeFromRemote(getConfFile.getConfidenceSet().unpack(), is_first_pull);
|
||||
@@ -224,8 +226,8 @@ void ConfidenceCalculator::pullProcessedData(const std::vector<std::string>& fil
|
||||
m_confidence_level = getConfFile.getConfidenceLevels().unpackMove();
|
||||
}
|
||||
}
|
||||
// is_first_pull = false -> at least one file was downloaded and merged
|
||||
if (is_first_pull) {
|
||||
// is_ok = false -> no file was downloaded and merged
|
||||
if (!is_ok) {
|
||||
dbgError(D_WAAP_CONFIDENCE_CALCULATOR) << "Failed to get the remote state";
|
||||
}
|
||||
}
|
||||
|
@@ -151,9 +151,9 @@ void TrustedSourcesConfidenceCalculator::pullProcessedData(const std::vector<std
|
||||
bool res = sendObjectWithRetry(getTrustFile,
|
||||
I_Messaging::Method::GET,
|
||||
getUri() + "/" + file);
|
||||
pull_ok |= res;
|
||||
if (res && getTrustFile.getTrustedLogs().ok()) {
|
||||
mergeFromRemote(getTrustFile.getTrustedLogs().unpack());
|
||||
pull_ok = true;
|
||||
}
|
||||
}
|
||||
if (!pull_ok && !files.empty()) {
|
||||
|
@@ -101,6 +101,24 @@ inline unsigned char from_hex(unsigned char ch, bool &valid) {
|
||||
return ch;
|
||||
}
|
||||
|
||||
inline bool str_starts_with(const std::string& value, const std::string& prefix)
|
||||
{
|
||||
if (prefix.size() > value.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return value.compare(0, prefix.size(), prefix) == 0;
|
||||
}
|
||||
|
||||
inline bool str_ends_with(const std::string& value, const std::string& ending)
|
||||
{
|
||||
if (ending.size() > value.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return value.compare(value.size() - ending.size(), ending.size(), ending) == 0;
|
||||
}
|
||||
|
||||
template<class _IT>
|
||||
_IT unquote_plus(_IT first, _IT last, bool decodeUrl=true, bool decodePlus=true) {
|
||||
_IT result = first;
|
||||
|
Reference in New Issue
Block a user