Correct the usage of modsecurity::Phases::NUMBER_OF_PHASES

This commit is contained in:
Wenfeng Liu
2018-11-21 06:28:20 +00:00
committed by Felipe Zimmerle
parent ce3abf2626
commit 3b3004d24d
4 changed files with 10 additions and 17 deletions

View File

@@ -51,6 +51,9 @@ bool Phase::init(std::string *error) {
} else if (m_phase == 5) {
m_phase = modsecurity::Phases::LoggingPhase;
m_secRulesPhase = 5;
} else {
error->assign("Unknown phase: " + m_parser_payload);
return false;
}
} catch (...) {
if (a == "request") {
@@ -64,16 +67,6 @@ bool Phase::init(std::string *error) {
m_secRulesPhase = 5;
}
}
if (m_phase == -1) {
error->assign("Not able to associate the given rule to any phase: " + \
m_parser_payload);
return false;
}
if (m_phase > modsecurity::Phases::NUMBER_OF_PHASES) {
error->assign("Unknown phase: " + std::to_string(m_phase));
return false;
}
return true;
}