From ef7f65db900a48603c5375fd33b228f820cb2840 Mon Sep 17 00:00:00 2001 From: Felipe Zimmerle Date: Fri, 19 Oct 2018 16:56:33 -0300 Subject: [PATCH] Changes debuglogs schema to avoid unecessary str allocation --- headers/modsecurity/debug_log.h | 2 +- headers/modsecurity/transaction.h | 24 + src/actions/block.cc | 4 +- src/actions/ctl/rule_engine.cc | 5 +- src/actions/disruptive/allow.cc | 5 +- src/actions/disruptive/deny.cc | 4 +- src/actions/disruptive/deny.h | 1 + src/actions/disruptive/pass.cc | 5 +- src/actions/exec.cc | 5 +- src/actions/init_col.cc | 4 +- src/actions/log.cc | 4 +- src/actions/msg.cc | 4 +- src/actions/set_env.cc | 4 +- src/actions/set_rsc.cc | 5 +- src/actions/set_sid.cc | 5 +- src/actions/set_uid.cc | 5 +- src/actions/set_var.cc | 46 +- src/actions/severity.cc | 5 +- src/actions/skip.cc | 9 +- src/actions/skip_after.cc | 5 +- src/actions/tag.cc | 5 +- src/anchored_set_variable.cc | 4 +- src/audit_log/audit_log.cc | 20 +- src/audit_log/writer/https.cc | 6 +- src/engine/lua.cc | 51 +- src/operators/detect_sqli.cc | 12 +- src/operators/detect_xss.cc | 16 +- src/operators/fuzzy_hash.cc | 8 +- src/operators/geo_lookup.cc | 5 + src/operators/geo_lookup.h | 3 + src/operators/operator.cc | 16 +- src/operators/operator.h | 3 - src/operators/pm.cc | 4 +- src/operators/rbl.cc | 38 +- src/operators/rx.cc | 4 +- src/operators/validate_dtd.cc | 24 +- src/operators/validate_dtd.h | 8 +- src/operators/validate_schema.cc | 32 +- src/operators/validate_schema.h | 8 +- src/operators/validate_url_encoding.cc | 16 +- src/operators/validate_utf8_encoding.cc | 24 +- src/operators/verify_cc.cc | 8 +- src/operators/verify_cpf.cc | 4 +- src/operators/verify_ssn.cc | 4 +- src/parser/seclang-parser.cc | 1224 +++++++++-------- src/request_body_processor/json.h | 6 - src/request_body_processor/multipart.cc | 359 ++--- src/request_body_processor/multipart.h | 6 - src/request_body_processor/xml.cc | 21 +- src/request_body_processor/xml.h | 5 - src/rule.cc | 103 +- src/rule_script.cc | 5 +- src/rules.cc | 35 +- src/transaction.cc | 154 +-- src/variables/xml.cc | 20 +- test/regression/regression.cc | 1 + test/test-cases/regression/collection-tx.json | 61 + 57 files changed, 1100 insertions(+), 1374 deletions(-) diff --git a/headers/modsecurity/debug_log.h b/headers/modsecurity/debug_log.h index dcffdead..c2501cf1 100644 --- a/headers/modsecurity/debug_log.h +++ b/headers/modsecurity/debug_log.h @@ -50,8 +50,8 @@ class DebugLog { const std::string& getDebugLogFile(); virtual int getDebugLogLevel(); - private: int m_debugLevel; + private: std::string m_fileName; }; diff --git a/headers/modsecurity/transaction.h b/headers/modsecurity/transaction.h index cd57c052..b6cfca33 100644 --- a/headers/modsecurity/transaction.h +++ b/headers/modsecurity/transaction.h @@ -48,6 +48,30 @@ typedef struct Rules_t Rules; #include "modsecurity/collection/collection.h" #include "modsecurity/variable_origin.h" +#ifndef NO_LOGS +#define ms_dbg(b, c) \ + do { \ + if (m_rules && m_rules->m_debugLog && m_rules->m_debugLog->m_debugLevel >= b) { \ + m_rules->debug(b, m_id, m_uri, c); \ + } \ + } while (0); +#else +#define ms_dbg(b, c) \ + do { } while (0); +#endif + +#ifndef NO_LOGS +#define ms_dbg_a(t, b, c) \ + do { \ + if (t && t->m_rules && t->m_rules->m_debugLog && t->m_rules->m_debugLog->m_debugLevel >= b) { \ + t->debug(b, c); \ + } \ + } while (0); +#else +#define ms_dbg_a(t, b, c) \ + do { } while (0); +#endif + #define LOGFY_ADD(a, b) \ yajl_gen_string(g, reinterpret_cast(a), strlen(a)); \ diff --git a/src/actions/block.cc b/src/actions/block.cc index 7de22f34..7227846e 100644 --- a/src/actions/block.cc +++ b/src/actions/block.cc @@ -31,9 +31,7 @@ namespace actions { bool Block::evaluate(Rule *rule, Transaction *transaction, std::shared_ptr rm) { -#ifndef NO_LOGS - transaction->debug(8, "Marking request as disruptive."); -#endif + ms_dbg_a(transaction, 8, "Marking request as disruptive."); for (Action *a : transaction->m_rules->m_defaultActions[rule->m_phase]) { if (a->isDisruptive() == false) { diff --git a/src/actions/ctl/rule_engine.cc b/src/actions/ctl/rule_engine.cc index 8e1d0d81..34250269 100644 --- a/src/actions/ctl/rule_engine.cc +++ b/src/actions/ctl/rule_engine.cc @@ -19,6 +19,7 @@ #include #include "modsecurity/rules_properties.h" +#include "modsecurity/rules.h" #include "modsecurity/transaction.h" namespace modsecurity { @@ -50,9 +51,7 @@ bool RuleEngine::evaluate(Rule *rule, Transaction *transaction) { a << modsecurity::RulesProperties::ruleEngineStateString(m_ruleEngine); a << " as requested by a ctl:ruleEngine action"; -#ifndef NO_LOGS - transaction->debug(8, a.str()); -#endif + ms_dbg_a(transaction, 8, a.str()); transaction->m_secRuleEngine = m_ruleEngine; return true; diff --git a/src/actions/disruptive/allow.cc b/src/actions/disruptive/allow.cc index c88f3870..bc2c614e 100644 --- a/src/actions/disruptive/allow.cc +++ b/src/actions/disruptive/allow.cc @@ -20,6 +20,7 @@ #include "modsecurity/transaction.h" #include "modsecurity/rule.h" +#include "modsecurity/rules.h" #include "src/utils/string.h" #include "modsecurity/modsecurity.h" @@ -49,11 +50,9 @@ bool Allow::init(std::string *error) { bool Allow::evaluate(Rule *rule, Transaction *transaction) { -#ifndef NO_LOGS - transaction->debug(4, "Dropping the evaluation of upcoming rules " \ + ms_dbg_a(transaction, 4, "Dropping the evaluation of upcoming rules " \ "in favor of an `allow' action of type: " \ + allowTypeToName(m_allowType)); -#endif transaction->m_allowType = m_allowType; diff --git a/src/actions/disruptive/deny.cc b/src/actions/disruptive/deny.cc index 2258b5fd..5bc38ef5 100644 --- a/src/actions/disruptive/deny.cc +++ b/src/actions/disruptive/deny.cc @@ -30,9 +30,7 @@ namespace disruptive { bool Deny::evaluate(Rule *rule, Transaction *transaction, std::shared_ptr rm) { -#ifndef NO_LOGS - transaction->debug(8, "Running action deny"); -#endif + ms_dbg_a(transaction, 8, "Running action deny"); if (transaction->m_it.status == 200) { transaction->m_it.status = 403; diff --git a/src/actions/disruptive/deny.h b/src/actions/disruptive/deny.h index 6f3bad64..0d8871ec 100644 --- a/src/actions/disruptive/deny.h +++ b/src/actions/disruptive/deny.h @@ -18,6 +18,7 @@ #include "modsecurity/actions/action.h" #include "modsecurity/transaction.h" +#include "modsecurity/rules.h" #include "modsecurity/rule_message.h" #ifndef SRC_ACTIONS_DISRUPTIVE_DENY_H_ diff --git a/src/actions/disruptive/pass.cc b/src/actions/disruptive/pass.cc index d4e6501d..d07763ab 100644 --- a/src/actions/disruptive/pass.cc +++ b/src/actions/disruptive/pass.cc @@ -21,6 +21,7 @@ #include "modsecurity/transaction.h" #include "modsecurity/rule.h" +#include "modsecurity/rules.h" #include "modsecurity/rule_message.h" namespace modsecurity { @@ -33,9 +34,7 @@ bool Pass::evaluate(Rule *rule, Transaction *transaction, intervention::free(&transaction->m_it); intervention::reset(&transaction->m_it); -#ifndef NO_LOGS - transaction->debug(8, "Running action pass"); -#endif + ms_dbg_a(transaction, 8, "Running action pass"); return true; } diff --git a/src/actions/exec.cc b/src/actions/exec.cc index 9b3481ed..eda7d29f 100644 --- a/src/actions/exec.cc +++ b/src/actions/exec.cc @@ -21,6 +21,7 @@ #include "modsecurity/actions/action.h" #include "modsecurity/transaction.h" #include "modsecurity/rule.h" +#include "modsecurity/rules.h" #include "src/utils/system.h" #include "src/engine/lua.h" @@ -49,9 +50,7 @@ bool Exec::init(std::string *error) { bool Exec::evaluate(Rule *rule, Transaction *t) { -#ifndef NO_LOGS - t->debug(8, "Running script... " + m_script); -#endif + ms_dbg_a(t, 8, "Running script... " + m_script); m_lua.run(t); return true; } diff --git a/src/actions/init_col.cc b/src/actions/init_col.cc index 7669259f..9338ea47 100644 --- a/src/actions/init_col.cc +++ b/src/actions/init_col.cc @@ -67,10 +67,8 @@ bool InitCol::evaluate(Rule *rule, Transaction *t) { return false; } -#ifndef NO_LOGS - t->debug(5, "Collection `" + m_collection_key + "' initialized with " \ + ms_dbg_a(t, 5, "Collection `" + m_collection_key + "' initialized with " \ "value: " + collectionName); -#endif return true; } diff --git a/src/actions/log.cc b/src/actions/log.cc index 66006c13..13a283cb 100644 --- a/src/actions/log.cc +++ b/src/actions/log.cc @@ -30,9 +30,7 @@ namespace actions { bool Log::evaluate(Rule *rule, Transaction *transaction, std::shared_ptr rm) { -#ifndef NO_LOGS - transaction->debug(9, "Saving transaction to logs"); -#endif + ms_dbg_a(transaction, 9, "Saving transaction to logs"); rm->m_saveMessage = true; return true; } diff --git a/src/actions/msg.cc b/src/actions/msg.cc index e27126a2..5e274846 100644 --- a/src/actions/msg.cc +++ b/src/actions/msg.cc @@ -50,9 +50,7 @@ bool Msg::evaluate(Rule *rule, Transaction *transaction, std::shared_ptr rm) { std::string msg = data(transaction); rm->m_message = msg; -#ifndef NO_LOGS - transaction->debug(9, "Saving msg: " + msg); -#endif + ms_dbg_a(transaction, 9, "Saving msg: " + msg); return true; } diff --git a/src/actions/set_env.cc b/src/actions/set_env.cc index 7665e504..82381ff9 100644 --- a/src/actions/set_env.cc +++ b/src/actions/set_env.cc @@ -34,10 +34,8 @@ bool SetENV::init(std::string *error) { bool SetENV::evaluate(Rule *rule, Transaction *t) { std::string colNameExpanded(m_string->evaluate(t)); -#ifndef NO_LOGS - t->debug(8, "Setting envoriment variable: " + ms_dbg_a(t, 8, "Setting envoriment variable: " + colNameExpanded + "."); -#endif putenv((char *)colNameExpanded.c_str()); diff --git a/src/actions/set_rsc.cc b/src/actions/set_rsc.cc index a53fe01a..c5fc1001 100644 --- a/src/actions/set_rsc.cc +++ b/src/actions/set_rsc.cc @@ -33,11 +33,8 @@ bool SetRSC::init(std::string *error) { bool SetRSC::evaluate(Rule *rule, Transaction *t) { std::string colNameExpanded(m_string->evaluate(t)); - -#ifndef NO_LOGS - t->debug(8, "RESOURCE initiated with value: \'" + ms_dbg_a(t, 8, "RESOURCE initiated with value: \'" + colNameExpanded + "\'."); -#endif t->m_collections.m_resource_collection_key = colNameExpanded; t->m_variableResource.set(colNameExpanded, t->m_variableOffset); diff --git a/src/actions/set_sid.cc b/src/actions/set_sid.cc index 9165426c..ca9fed27 100644 --- a/src/actions/set_sid.cc +++ b/src/actions/set_sid.cc @@ -33,11 +33,8 @@ bool SetSID::init(std::string *error) { bool SetSID::evaluate(Rule *rule, Transaction *t) { std::string colNameExpanded(m_string->evaluate(t)); - -#ifndef NO_LOGS - t->debug(8, "Session ID initiated with value: \'" + ms_dbg_a(t, 8, "Session ID initiated with value: \'" + colNameExpanded + "\'."); -#endif t->m_collections.m_session_collection_key = colNameExpanded; t->m_variableSessionID.set(colNameExpanded, t->m_variableOffset); diff --git a/src/actions/set_uid.cc b/src/actions/set_uid.cc index 8d978e58..75d39b0c 100644 --- a/src/actions/set_uid.cc +++ b/src/actions/set_uid.cc @@ -33,11 +33,8 @@ bool SetUID::init(std::string *error) { bool SetUID::evaluate(Rule *rule, Transaction *t) { std::string colNameExpanded(m_string->evaluate(t)); - -#ifndef NO_LOGS - t->debug(8, "User collection initiated with value: \'" + ms_dbg_a(t, 8, "User collection initiated with value: \'" + colNameExpanded + "\'."); -#endif t->m_collections.m_user_collection_key = colNameExpanded; t->m_variableUserID.set(colNameExpanded, t->m_variableOffset); diff --git a/src/actions/set_var.cc b/src/actions/set_var.cc index 7030ce6c..e099fb5b 100644 --- a/src/actions/set_var.cc +++ b/src/actions/set_var.cc @@ -133,30 +133,30 @@ bool SetVar::evaluate(Rule *rule, Transaction *t) { } } -#ifndef NO_LOGS - t->debug(8, "Saving variable: " + m_variable->m_collectionName \ + ms_dbg_a(t, 8, "Saving variable: " + m_variable->m_collectionName \ + ":" + m_variableNameExpanded + " with value: " + targetValue); -#endif - if (tx) { - tx->storeOrUpdateFirst(t, m_variableNameExpanded, targetValue); - } else if (session) { - session->storeOrUpdateFirst(t, m_variableNameExpanded, targetValue); - } else if (ip) { - ip->storeOrUpdateFirst(t, m_variableNameExpanded, targetValue); - } else if (resource) { - resource->storeOrUpdateFirst(t, m_variableNameExpanded, targetValue); - } else if (global) { - global->storeOrUpdateFirst(t, m_variableNameExpanded, targetValue); - } else if (user) { - user->storeOrUpdateFirst(t, m_variableNameExpanded, targetValue); - } else { - // ? - } -/* - t->m_collections.storeOrUpdateFirst(m_variable->m_collectionName, - m_variableNameExpanded, - t->m_rules->m_secWebAppId.m_value, targetValue); - */ + + if (tx) { + tx->storeOrUpdateFirst(t, m_variableNameExpanded, targetValue); + } else if (session) { + session->storeOrUpdateFirst(t, m_variableNameExpanded, targetValue); + } else if (ip) { + ip->storeOrUpdateFirst(t, m_variableNameExpanded, targetValue); + } else if (resource) { + resource->storeOrUpdateFirst(t, m_variableNameExpanded, targetValue); + } else if (global) { + global->storeOrUpdateFirst(t, m_variableNameExpanded, targetValue); + } else if (user) { + user->storeOrUpdateFirst(t, m_variableNameExpanded, targetValue); + } else { + // ? + } + + /* + t->m_collections.storeOrUpdateFirst(m_variable->m_collectionName, + m_variableNameExpanded, + t->m_rules->m_secWebAppId.m_value, targetValue); + */ end: return true; } diff --git a/src/actions/severity.cc b/src/actions/severity.cc index 4600ff98..d90ce63b 100644 --- a/src/actions/severity.cc +++ b/src/actions/severity.cc @@ -22,6 +22,7 @@ #include "modsecurity/actions/action.h" #include "modsecurity/transaction.h" #include "modsecurity/rule.h" +#include "modsecurity/rules.h" #include "src/utils/string.h" #include "modsecurity/rule_message.h" @@ -72,11 +73,9 @@ bool Severity::init(std::string *error) { bool Severity::evaluate(Rule *rule, Transaction *transaction, std::shared_ptr rm) { -#ifndef NO_LOGS - transaction->debug(9, "This rule severity is: " + \ + ms_dbg_a(transaction, 9, "This rule severity is: " + \ std::to_string(this->m_severity) + " current transaction is: " + \ std::to_string(transaction->m_highestSeverityAction)); -#endif rm->m_severity = m_severity; diff --git a/src/actions/skip.cc b/src/actions/skip.cc index 90a49a51..1b618fe0 100644 --- a/src/actions/skip.cc +++ b/src/actions/skip.cc @@ -20,7 +20,7 @@ #include "modsecurity/actions/action.h" #include "modsecurity/transaction.h" - +#include "modsecurity/rules.h" namespace modsecurity { namespace actions { @@ -39,10 +39,9 @@ bool Skip::init(std::string *error) { bool Skip::evaluate(Rule *rule, Transaction *transaction) { -#ifndef NO_LOGS - transaction->debug(5, "Skipping the next " + std::to_string(m_skip_next) \ - + " rules."); -#endif + ms_dbg_a(transaction, 5, "Skipping the next " + \ + std::to_string(m_skip_next) + " rules."); + transaction->m_skip_next = m_skip_next; return true; diff --git a/src/actions/skip_after.cc b/src/actions/skip_after.cc index 795bdc55..ba07e73a 100644 --- a/src/actions/skip_after.cc +++ b/src/actions/skip_after.cc @@ -20,6 +20,7 @@ #include "modsecurity/actions/action.h" #include "modsecurity/transaction.h" +#include "modsecurity/rules.h" namespace modsecurity { @@ -27,9 +28,7 @@ namespace actions { bool SkipAfter::evaluate(Rule *rule, Transaction *transaction) { -#ifndef NO_LOGS - transaction->debug(5, "Setting skipAfter for: " + m_parser_payload); -#endif + ms_dbg_a(transaction, 5, "Setting skipAfter for: " + m_parser_payload); transaction->m_marker = m_parser_payload; return true; } diff --git a/src/actions/tag.cc b/src/actions/tag.cc index 6f3f0663..40a83324 100644 --- a/src/actions/tag.cc +++ b/src/actions/tag.cc @@ -59,10 +59,7 @@ std::string Tag::getName(Transaction *transaction) { bool Tag::evaluate(Rule *rule, Transaction *transaction, std::shared_ptr rm) { std::string tag = getName(transaction); - -#ifndef NO_LOGS - transaction->debug(9, "Rule tag: " + tag); -#endif + ms_dbg_a(transaction, 9, "Rule tag: " + tag); rm->m_tags.push_back(tag); diff --git a/src/anchored_set_variable.cc b/src/anchored_set_variable.cc index 04ed2e70..faf3c744 100644 --- a/src/anchored_set_variable.cc +++ b/src/anchored_set_variable.cc @@ -96,7 +96,7 @@ void AnchoredSetVariable::resolve( if (!ke.toOmit(x.first)) { l->insert(l->begin(), new VariableValue(x.second)); } else { - m_transaction->debug(7, "Excluding key: " + x.first + ms_dbg_a(m_transaction, 7, "Excluding key: " + x.first + " from target value."); } } @@ -147,7 +147,7 @@ void AnchoredSetVariable::resolveRegularExpression(Utils::Regex *r, if (!ke.toOmit(x.first)) { l->insert(l->begin(), new VariableValue(x.second)); } else { - m_transaction->debug(7, "Excluding key: " + x.first + ms_dbg_a(m_transaction, 7, "Excluding key: " + x.first + " from target value."); } } diff --git a/src/audit_log/audit_log.cc b/src/audit_log/audit_log.cc index b95eaf1d..fb7fe625 100644 --- a/src/audit_log/audit_log.cc +++ b/src/audit_log/audit_log.cc @@ -292,9 +292,7 @@ bool AuditLog::saveIfRelevant(Transaction *transaction) { bool AuditLog::saveIfRelevant(Transaction *transaction, int parts) { bool saveAnyway = false; if (m_status == OffAuditLogStatus || m_status == NotSetLogStatus) { -#ifndef NO_LOGS - transaction->debug(5, "Audit log engine was not set."); -#endif + ms_dbg_a(transaction, 5, "Audit log engine was not set."); return true; } @@ -308,12 +306,10 @@ bool AuditLog::saveIfRelevant(Transaction *transaction, int parts) { if ((m_status == RelevantOnlyAuditLogStatus && this->isRelevant(transaction->m_httpCodeReturned) == false) && saveAnyway == false) { -#ifndef NO_LOGS - transaction->debug(9, "Return code `" + + ms_dbg_a(transaction, 9, "Return code `" + std::to_string(transaction->m_httpCodeReturned) + "'" \ " is not interesting to audit logs, relevant code(s): `" + m_relevant + "'."); -#endif return false; } @@ -321,21 +317,15 @@ bool AuditLog::saveIfRelevant(Transaction *transaction, int parts) { if (parts == -1) { parts = m_parts; } -#ifndef NO_LOGS - transaction->debug(5, "Saving this request as part " \ + ms_dbg_a(transaction, 5, "Saving this request as part " \ "of the audit logs."); -#endif if (m_writer == NULL) { -#ifndef NO_LOGS - transaction->debug(1, "Internal error, audit log writer is null"); -#endif + ms_dbg_a(transaction, 1, "Internal error, audit log writer is null"); } else { std::string error; bool a = m_writer->write(transaction, parts, &error); if (a == false) { -#ifndef NO_LOGS - transaction->debug(1, "Cannot save the audit log: " + error); -#endif + ms_dbg_a(transaction, 1, "Cannot save the audit log: " + error); return false; } } diff --git a/src/audit_log/writer/https.cc b/src/audit_log/writer/https.cc index 7602cd60..17cd3718 100644 --- a/src/audit_log/writer/https.cc +++ b/src/audit_log/writer/https.cc @@ -27,10 +27,12 @@ #include "modsecurity/audit_log.h" #include "modsecurity/transaction.h" +#include "modsecurity/rules.h" #include "src/utils/md5.h" #include "src/utils/https_client.h" + namespace modsecurity { namespace audit_log { namespace writer { @@ -47,9 +49,7 @@ bool Https::init(std::string *error) { bool Https::write(Transaction *transaction, int parts, std::string *error) { Utils::HttpsClient m_http_client; -#ifndef NO_LOGS - transaction->debug(7, "Sending logs to: " + m_audit->m_path1); -#endif + ms_dbg_a(transaction, 7, "Sending logs to: " + m_audit->m_path1); std::string log = transaction->toJSON(parts); m_http_client.setRequestType("application/json"); diff --git a/src/engine/lua.cc b/src/engine/lua.cc index feecb551..f33a674a 100644 --- a/src/engine/lua.cc +++ b/src/engine/lua.cc @@ -161,9 +161,7 @@ int Lua::run(Transaction *t) { #endif } e.append(lua_tostring(L, -1)); -#ifndef NO_LOGS - t->debug(2, e); -#endif + ms_dbg_a(t, 2, e); ret = false; goto err; } @@ -177,9 +175,8 @@ int Lua::run(Transaction *t) { e.append(" - "); e.append(luaerr); } -#ifndef NO_LOGS - t->debug(2, e); -#endif + ms_dbg_a(t, 2, e); + ret = false; goto err; } @@ -195,9 +192,8 @@ int Lua::run(Transaction *t) { e.append(" - "); e.append(luaerr); } -#ifndef NO_LOGS - t->debug(2, e); -#endif + ms_dbg_a(t, 2, e); + ret = false; goto err; } @@ -206,9 +202,8 @@ int Lua::run(Transaction *t) { if (a != NULL) { luaRet.assign(a); } -#ifndef NO_LOGS - t->debug(9, "Returning from lua script: " + luaRet); -#endif + + ms_dbg_a(t, 9, "Returning from lua script: " + luaRet); if (luaRet.size() == 0) { ret = false; @@ -221,9 +216,8 @@ err: return ret; #else -#ifndef NO_LOGS - t->debug(9, "Lua support was not enabled."); -#endif + ms_dbg_a(t, 9, "Lua support was not enabled."); + return false; #endif } @@ -245,9 +239,7 @@ int Lua::log(lua_State *L) { /* Log message. */ if (t != NULL) { -#ifndef NO_LOGS - t->debug(level, text); -#endif + ms_dbg_a(t, level, text); } return 0; @@ -339,9 +331,8 @@ int Lua::setvar(lua_State *L) { if (nargs != 2) { -#ifndef NO_LOGS - t->debug(8, "m.setvar: Failed m.setvar funtion must has 2 arguments"); -#endif + ms_dbg_a(t, 8, + "m.setvar: Failed m.setvar funtion must has 2 arguments"); return -1; } var_value = luaL_checkstring(L, 2); @@ -362,10 +353,9 @@ int Lua::setvar(lua_State *L) { std::string::npos); } else { -#ifndef NO_LOGS - t->debug(8, "m.setvar: Must specify a collection using dot character" \ + ms_dbg_a(t, 8, + "m.setvar: Must specify a collection using dot character" \ " - ie m.setvar(tx.myvar,mydata)"); -#endif return -1; } @@ -443,10 +433,9 @@ std::string Lua::applyTransformations(lua_State *L, Transaction *t, if (tfn) { newVar = tfn->evaluate(newVar, t); } else { -#ifndef NO_LOGS - t->debug(1, "SecRuleScript: Invalid transformation function: " \ + ms_dbg_a(t, 1, + "SecRuleScript: Invalid transformation function: " \ + std::string(name)); -#endif } delete tfn; } @@ -467,19 +456,15 @@ std::string Lua::applyTransformations(lua_State *L, Transaction *t, newVar = tfn->evaluate(newVar, t); delete tfn; } else { -#ifndef NO_LOGS - t->debug(1, "SecRuleScript: Invalid transformation function: " \ + ms_dbg_a(t, 1, "SecRuleScript: Invalid transformation function: " \ + std::string(name)); -#endif } return newVar; } -#ifndef NO_LOGS - t->debug(8, "SecRuleScript: Transformation parameter must be a " \ + ms_dbg_a(t, 8, "SecRuleScript: Transformation parameter must be a " \ "transformation name or array of transformation names, but found " \ "" + std::string(lua_typename(L, idx)) + " (type " \ + std::to_string(lua_type(L, idx)) + ")"); -#endif return newVar; } #endif diff --git a/src/operators/detect_sqli.cc b/src/operators/detect_sqli.cc index 71cb4ede..a0fbfd1a 100644 --- a/src/operators/detect_sqli.cc +++ b/src/operators/detect_sqli.cc @@ -35,26 +35,20 @@ bool DetectSQLi::evaluate(Transaction *t, Rule *rule, if (issqli) { if (t) { t->m_matched.push_back(fingerprint); -#ifndef NO_LOGS - t->debug(4, "detected SQLi using libinjection with " \ + ms_dbg_a(t, 4, "detected SQLi using libinjection with " \ "fingerprint '" + std::string(fingerprint) + "' at: '" + input + "'"); -#endif if (rule && t && rule->m_containsCaptureAction) { t->m_collections.m_tx_collection->storeOrUpdateFirst( "0", std::string(fingerprint)); -#ifndef NO_LOGS - t->debug(7, "Added DetectSQLi match TX.0: " + \ + ms_dbg_a(t, 7, "Added DetectSQLi match TX.0: " + \ std::string(fingerprint)); -#endif } } } else { if (t) { -#ifndef NO_LOGS - t->debug(9, "detected SQLi: not able to find an " \ + ms_dbg_a(t, 9, "detected SQLi: not able to find an " \ "inject on '" + input + "'"); -#endif } } diff --git a/src/operators/detect_xss.cc b/src/operators/detect_xss.cc index 6ba54f5f..14b79e3d 100644 --- a/src/operators/detect_xss.cc +++ b/src/operators/detect_xss.cc @@ -33,22 +33,16 @@ bool DetectXSS::evaluate(Transaction *t, Rule *rule, if (t) { if (is_xss) { -#ifndef NO_LOGS - t->debug(5, "detected XSS using libinjection."); -#endif + ms_dbg_a(t, 5, "detected XSS using libinjection."); if (rule && t && rule->m_containsCaptureAction) { t->m_collections.m_tx_collection->storeOrUpdateFirst( "0", std::string(input)); -#ifndef NO_LOGS - t->debug(7, "Added DetectXSS match TX.0: " + \ + ms_dbg_a(t, 7, "Added DetectXSS match TX.0: " + \ std::string(input)); -#endif - } + } } else { -#ifndef NO_LOGS - t->debug(9, "libinjection was not able to " \ - "find any XSS in: " + input); -#endif + ms_dbg_a(t, 9, "libinjection was not able to " \ + "find any XSS in: " + input); } } return is_xss != 0; diff --git a/src/operators/fuzzy_hash.cc b/src/operators/fuzzy_hash.cc index 4b7144ea..9860bd65 100644 --- a/src/operators/fuzzy_hash.cc +++ b/src/operators/fuzzy_hash.cc @@ -103,19 +103,15 @@ bool FuzzyHash::evaluate(Transaction *t, const std::string &str) { if (fuzzy_hash_buf((const unsigned char*)str.c_str(), str.size(), result)) { -#ifndef NO_LOGS - t->debug(4, "Problems generating fuzzy hash"); -#endif + ms_dbg_a(t, 4, "Problems generating fuzzy hash"); return false; } while (chunk != NULL) { int i = fuzzy_compare(chunk->data, result); if (i >= m_threshold) { -#ifndef NO_LOGS - t->debug(4, "Fuzzy hash: matched " \ + ms_dbg_a(t, 4, "Fuzzy hash: matched " \ "with score: " + std::to_string(i) + "."); -#endif return true; } chunk = chunk->next; diff --git a/src/operators/geo_lookup.cc b/src/operators/geo_lookup.cc index 274772a2..eb0116e3 100644 --- a/src/operators/geo_lookup.cc +++ b/src/operators/geo_lookup.cc @@ -33,6 +33,11 @@ namespace modsecurity { namespace operators { +bool GeoLookup::debug(Transaction *transaction, int x, std::string a) { + ms_dbg_a(transaction, x, a); + return true; +} + bool GeoLookup::evaluate(Transaction *trans, const std::string &exp) { using std::placeholders::_1; diff --git a/src/operators/geo_lookup.h b/src/operators/geo_lookup.h index 3f4d8e04..a411fdb5 100644 --- a/src/operators/geo_lookup.h +++ b/src/operators/geo_lookup.h @@ -30,6 +30,9 @@ class GeoLookup : public Operator { GeoLookup() : Operator("GeoLookup") { } bool evaluate(Transaction *transaction, const std::string &exp) override; + + protected: + bool debug(Transaction *transaction, int x, std::string a); }; } // namespace operators diff --git a/src/operators/operator.cc b/src/operators/operator.cc index ca1d2157..adeb6289 100644 --- a/src/operators/operator.cc +++ b/src/operators/operator.cc @@ -68,13 +68,6 @@ namespace modsecurity { namespace operators { -bool Operator::debug(Transaction *transaction, int x, std::string a) { -#ifndef NO_LOGS - transaction->debug(x, a); -#endif - return true; -} - bool Operator::evaluateInternal(Transaction *transaction, Rule *rule, const std::string& a, std::shared_ptr rm) { bool res = evaluate(transaction, rule, a, rm); @@ -138,13 +131,8 @@ std::string Operator::resolveMatchMessage(Transaction *t, bool Operator::evaluate(Transaction *transaction, const std::string& a) { -#ifndef NO_LOGS - if (transaction) { - transaction->debug(2, "Operator: " + this->m_op + \ - " is not implemented or malfunctioning."); - } -#endif - + ms_dbg_a(transaction, 2, "Operator: " + m_op + \ + " is not implemented or malfunctioning."); return true; } diff --git a/src/operators/operator.h b/src/operators/operator.h index 8752b212..c147d12e 100644 --- a/src/operators/operator.h +++ b/src/operators/operator.h @@ -142,9 +142,6 @@ class Operator { std::string m_param; std::unique_ptr m_string; bool m_couldContainsMacro; - - protected: - bool debug(Transaction *transaction, int x, std::string a); }; } // namespace operators diff --git a/src/operators/pm.cc b/src/operators/pm.cc index 00823d43..e08bc649 100644 --- a/src/operators/pm.cc +++ b/src/operators/pm.cc @@ -106,10 +106,8 @@ bool Pm::evaluate(Transaction *transaction, Rule *rule, if (rule && rule->m_containsCaptureAction && transaction && rc) { transaction->m_collections.m_tx_collection->storeOrUpdateFirst("0", std::string(match)); -#ifndef NO_LOGS - transaction->debug(7, "Added pm match TX.0: " + \ + ms_dbg_a(transaction, 7, "Added pm match TX.0: " + \ std::string(match)); -#endif } return rc > 0; diff --git a/src/operators/rbl.cc b/src/operators/rbl.cc index 39210af5..5cf794d9 100644 --- a/src/operators/rbl.cc +++ b/src/operators/rbl.cc @@ -39,7 +39,7 @@ std::string Rbl::mapIpToAddress(std::string ipStr, Transaction *trans) { } if (sscanf(ipStr.c_str(), "%d.%d.%d.%d", &h0, &h1, &h2, &h3) != 4) { - debug(trans, 0, std::string("Failed to understand `" + ipStr + + ms_dbg_a(trans, 0, std::string("Failed to understand `" + ipStr + "' as a valid IP address, assuming domain format input")); addr = ipStr + "." + m_service; @@ -47,7 +47,7 @@ std::string Rbl::mapIpToAddress(std::string ipStr, Transaction *trans) { } if (m_demandsPassword && key.empty()) { - debug(trans, 0, std::string("Missing RBL key, cannot continue " \ + ms_dbg_a(trans, 0, std::string("Missing RBL key, cannot continue " \ "with the operator execution, please set the key using: " \ "SecHttpBlKey")); return addr; @@ -76,12 +76,12 @@ void Rbl::futherInfo_httpbl(struct sockaddr_in *sin, std::string ipStr, respBl = inet_ntoa(sin->sin_addr); if (sscanf(respBl, "%d.%d.%d.%d", &first, &days, &score, &type) != 4) { - debug(trans, 4, "RBL lookup of " + ipStr + " failed: bad response"); + ms_dbg_a(trans, 4, "RBL lookup of " + ipStr + " failed: bad response"); return; } if (first != 127) { - debug(trans, 4, "RBL lookup of " + ipStr + " failed: bad response"); + ms_dbg_a(trans, 4, "RBL lookup of " + ipStr + " failed: bad response"); return; } @@ -114,7 +114,7 @@ void Rbl::futherInfo_httpbl(struct sockaddr_in *sin, std::string ipStr, ptype = " "; } - debug(trans, 4, "RBL lookup of " + ipStr + " succeeded. %s: " \ + ms_dbg_a(trans, 4, "RBL lookup of " + ipStr + " succeeded. %s: " \ + std::to_string(days) + " " \ "days since last activity, threat score " \ + std::to_string(score) + ". Case: " + ptype); @@ -126,23 +126,23 @@ void Rbl::futherInfo_spamhaus(unsigned int high8bits, std::string ipStr, switch (high8bits) { case 2: case 3: - debug(trans, 4, "RBL lookup of " + ipStr + " succeeded " \ + ms_dbg_a(trans, 4, "RBL lookup of " + ipStr + " succeeded " \ "(Static UBE sources)."); break; case 4: case 5: case 6: case 7: - debug(trans, 4, "RBL lookup of " + ipStr + " succeeded " \ + ms_dbg_a(trans, 4, "RBL lookup of " + ipStr + " succeeded " \ "(Illegal 3rd party exploits)."); break; case 10: case 11: - debug(trans, 4, "RBL lookup of " + ipStr + " succeeded " \ + ms_dbg_a(trans, 4, "RBL lookup of " + ipStr + " succeeded " \ "(Delivering unauthenticated SMTP email)."); break; default: - debug(trans, 4, "RBL lookup of " + ipStr + " succeeded "); + ms_dbg_a(trans, 4, "RBL lookup of " + ipStr + " succeeded "); break; } } @@ -152,24 +152,24 @@ void Rbl::futherInfo_uribl(unsigned int high8bits, std::string ipStr, Transaction *trans) { switch (high8bits) { case 2: - debug(trans, 4, "RBL lookup of " + ipStr + " succeeded (BLACK)."); + ms_dbg_a(trans, 4, "RBL lookup of " + ipStr + " succeeded (BLACK)."); break; case 4: - debug(trans, 4, "RBL lookup of " + ipStr + " succeeded (GREY)."); + ms_dbg_a(trans, 4, "RBL lookup of " + ipStr + " succeeded (GREY)."); break; case 8: - debug(trans, 4, "RBL lookup of " + ipStr + " succeeded (RED)."); + ms_dbg_a(trans, 4, "RBL lookup of " + ipStr + " succeeded (RED)."); break; case 14: - debug(trans, 4, "RBL lookup of " + ipStr + " succeeded " \ + ms_dbg_a(trans, 4, "RBL lookup of " + ipStr + " succeeded " \ "(BLACK,GREY,RED)."); break; case 255: - debug(trans, 4, "RBL lookup of " + ipStr + " succeeded " \ + ms_dbg_a(trans, 4, "RBL lookup of " + ipStr + " succeeded " \ "(DNS IS BLOCKED)."); break; default: - debug(trans, 4, "RBL lookup of " + ipStr + " succeeded (WHITE)."); + ms_dbg_a(trans, 4, "RBL lookup of " + ipStr + " succeeded (WHITE)."); break; } } @@ -181,7 +181,7 @@ void Rbl::furtherInfo(struct sockaddr_in *sin, std::string ipStr, switch (m_provider) { case RblProvider::UnknownProvider: - debug(trans, 2, "RBL lookup of " + ipStr + " succeeded."); + ms_dbg_a(trans, 2, "RBL lookup of " + ipStr + " succeeded."); break; case RblProvider::httpbl: futherInfo_httpbl(sin, ipStr, trans); @@ -213,7 +213,7 @@ bool Rbl::evaluate(Transaction *t, Rule *rule, if (info != NULL) { freeaddrinfo(info); } - debug(t, 5, "RBL lookup of " + ipStr + " failed."); + ms_dbg_a(t, 5, "RBL lookup of " + ipStr + " failed."); return false; } @@ -225,10 +225,8 @@ bool Rbl::evaluate(Transaction *t, Rule *rule, if (rule && t && rule->m_containsCaptureAction) { t->m_collections.m_tx_collection->storeOrUpdateFirst( "0", std::string(ipStr)); -#ifndef NO_LOGS - t->debug(7, "Added RXL match TX.0: " + \ + ms_dbg_a(t, 7, "Added RXL match TX.0: " + \ std::string(ipStr)); -#endif } return true; diff --git a/src/operators/rx.cc b/src/operators/rx.cc index 36a43693..1891a8bb 100644 --- a/src/operators/rx.cc +++ b/src/operators/rx.cc @@ -60,10 +60,8 @@ bool Rx::evaluate(Transaction *transaction, Rule *rule, for (const SMatch& a : matches) { transaction->m_collections.m_tx_collection->storeOrUpdateFirst( std::to_string(i), a.match); -#ifndef NO_LOGS - transaction->debug(7, "Added regex subexpression TX." + + ms_dbg_a(transaction, 7, "Added regex subexpression TX." + std::to_string(i) + ": " + a.match); -#endif transaction->m_matched.push_back(a.match); i++; } diff --git a/src/operators/validate_dtd.cc b/src/operators/validate_dtd.cc index 5767a6a4..a993fab9 100644 --- a/src/operators/validate_dtd.cc +++ b/src/operators/validate_dtd.cc @@ -50,25 +50,19 @@ bool ValidateDTD::evaluate(Transaction *t, const std::string &str) { if (m_dtd == NULL) { std::string err = std::string("XML: Failed to load DTD: ") \ + m_resource; -#ifndef NO_LOGS - t->debug(4, err); -#endif + ms_dbg_a(t, 4, err); return true; } if (t->m_xml->m_data.doc == NULL) { -#ifndef NO_LOGS - t->debug(4, "XML document tree could not "\ + ms_dbg_a(t, 4, "XML document tree could not "\ "be found for DTD validation."); -#endif return true; } if (t->m_xml->m_data.well_formed != 1) { -#ifndef NO_LOGS - t->debug(4, "XML: DTD validation failed because " \ + ms_dbg_a(t, 4, "XML: DTD validation failed because " \ "content is not well formed."); -#endif return true; } @@ -84,9 +78,7 @@ bool ValidateDTD::evaluate(Transaction *t, const std::string &str) { cvp = xmlNewValidCtxt(); if (cvp == NULL) { -#ifndef NO_LOGS - t->debug(4, "XML: Failed to create a validation context."); -#endif + ms_dbg_a(t, 4, "XML: Failed to create a validation context."); return true; } @@ -96,17 +88,13 @@ bool ValidateDTD::evaluate(Transaction *t, const std::string &str) { cvp->userData = t; if (!xmlValidateDtd(cvp, t->m_xml->m_data.doc, m_dtd)) { -#ifndef NO_LOGS - t->debug(4, "XML: DTD validation failed."); -#endif + ms_dbg_a(t, 4, "XML: DTD validation failed."); xmlFreeValidCtxt(cvp); return true; } -#ifndef NO_LOGS - t->debug(4, std::string("XML: Successfully validated " \ + ms_dbg_a(t, 4, std::string("XML: Successfully validated " \ "payload against DTD: ") + m_resource); -#endif xmlFreeValidCtxt(cvp); diff --git a/src/operators/validate_dtd.h b/src/operators/validate_dtd.h index fc749e9d..ffbd6cff 100644 --- a/src/operators/validate_dtd.h +++ b/src/operators/validate_dtd.h @@ -63,9 +63,7 @@ class ValidateDTD : public Operator { if (len > 0) { s = "XML Error: " + std::string(buf); } -#ifndef NO_LOGS - t->debug(4, s); -#endif + ms_dbg_a(t, 4, s); } @@ -82,9 +80,7 @@ class ValidateDTD : public Operator { if (len > 0) { s = "XML Warning: " + std::string(buf); } -#ifndef NO_LOGS - t->debug(4, s); -#endif + ms_dbg_a(t, 4, s); } diff --git a/src/operators/validate_schema.cc b/src/operators/validate_schema.cc index 658c8674..3ce49ba9 100644 --- a/src/operators/validate_schema.cc +++ b/src/operators/validate_schema.cc @@ -52,9 +52,7 @@ bool ValidateSchema::evaluate(Transaction *t, if (m_err.empty() == false) { err << m_err; } -#ifndef NO_LOGS - t->debug(4, err.str()); -#endif + ms_dbg_a(t, 4, err.str()); return true; } @@ -77,9 +75,7 @@ bool ValidateSchema::evaluate(Transaction *t, if (m_err.empty() == false) { err << " " << m_err; } -#ifndef NO_LOGS - t->debug(4, err.str()); -#endif + ms_dbg_a(t, 4, err.str()); xmlSchemaFreeParserCtxt(m_parserCtx); return true; } @@ -90,9 +86,7 @@ bool ValidateSchema::evaluate(Transaction *t, if (m_err.empty() == false) { err << " " << m_err; } -#ifndef NO_LOGS - t->debug(4, err.str()); -#endif + ms_dbg_a(t, 4, err.str()); return true; } @@ -102,46 +96,36 @@ bool ValidateSchema::evaluate(Transaction *t, (xmlSchemaValidityWarningFunc)warn_runtime, t); if (t->m_xml->m_data.doc == NULL) { -#ifndef NO_LOGS - t->debug(4, "XML document tree could not be found for " \ + ms_dbg_a(t, 4, "XML document tree could not be found for " \ "schema validation."); -#endif return true; } if (t->m_xml->m_data.well_formed != 1) { -#ifndef NO_LOGS - t->debug(4, "XML: Schema validation failed because " \ + ms_dbg_a(t, 4, "XML: Schema validation failed because " \ "content is not well formed."); -#endif return true; } /* Make sure there were no other generic processing errors */ /* if (msr->msc_reqbody_error) { -#ifndef NO_LOGS - t->debug(4, "XML: Schema validation could not proceed due to previous" + ms_dbg_a(t, 4, "XML: Schema validation could not proceed due to previous" " processing errors."); -#endif return true; } */ rc = xmlSchemaValidateDoc(m_validCtx, t->m_xml->m_data.doc); if (rc != 0) { -#ifndef NO_LOGS - t->debug(4, "XML: Schema validation failed."); -#endif + ms_dbg_a(t, 4, "XML: Schema validation failed."); xmlSchemaFree(m_schema); xmlSchemaFreeParserCtxt(m_parserCtx); return true; /* No match. */ } -#ifndef NO_LOGS - t->debug(4, "XML: Successfully validated payload against " \ + ms_dbg_a(t, 4, "XML: Successfully validated payload against " \ "Schema: " + m_resource); -#endif xmlSchemaFree(m_schema); xmlSchemaFreeParserCtxt(m_parserCtx); diff --git a/src/operators/validate_schema.h b/src/operators/validate_schema.h index e07e237b..8bf6bd2a 100644 --- a/src/operators/validate_schema.h +++ b/src/operators/validate_schema.h @@ -105,9 +105,7 @@ class ValidateSchema : public Operator { if (len > 0) { s = "XML Error: " + std::string(buf); } -#ifndef NO_LOGS - t->debug(4, s); -#endif + ms_dbg_a(t, 4, s); } @@ -124,9 +122,7 @@ class ValidateSchema : public Operator { if (len > 0) { s = "XML Warning: " + std::string(buf); } -#ifndef NO_LOGS - t->debug(4, s); -#endif + ms_dbg_a(t, 4, s); } static void null_error(void *ctx, const char *msg, ...) { diff --git a/src/operators/validate_url_encoding.cc b/src/operators/validate_url_encoding.cc index ff8bc20c..43b63e6a 100644 --- a/src/operators/validate_url_encoding.cc +++ b/src/operators/validate_url_encoding.cc @@ -82,28 +82,22 @@ bool ValidateUrlEncoding::evaluate(Transaction *transaction, Rule *rule, case 1 : /* Encoding is valid */ if (transaction) { -#ifndef NO_LOGS - transaction->debug(7, "Valid URL Encoding at '" +input + "'"); -#endif + ms_dbg_a(transaction, 7, "Valid URL Encoding at '" +input + "'"); } res = false; break; case -2 : if (transaction) { -#ifndef NO_LOGS - transaction->debug(7, "Invalid URL Encoding: Non-hexadecimal " + ms_dbg_a(transaction, 7, "Invalid URL Encoding: Non-hexadecimal " "digits used at '" + input + "'"); -#endif logOffset(ruleMessage, offset, input.size()); } res = true; /* Invalid match. */ break; case -3 : if (transaction) { -#ifndef NO_LOGS - transaction->debug(7, "Invalid URL Encoding: Not enough " \ + ms_dbg_a(transaction, 7, "Invalid URL Encoding: Not enough " \ "characters at the end of input at '" + input + "'"); -#endif logOffset(ruleMessage, offset, input.size()); } res = true; /* Invalid match. */ @@ -111,11 +105,9 @@ bool ValidateUrlEncoding::evaluate(Transaction *transaction, Rule *rule, case -1 : default : if (transaction) { -#ifndef NO_LOGS - transaction->debug(7, "Invalid URL Encoding: Internal " \ + ms_dbg_a(transaction, 7, "Invalid URL Encoding: Internal " \ "Error (rc = " + std::to_string(rc) + ") at '" + input + "'"); -#endif logOffset(ruleMessage, offset, input.size()); } res = true; diff --git a/src/operators/validate_utf8_encoding.cc b/src/operators/validate_utf8_encoding.cc index 2e917787..a0c178d1 100644 --- a/src/operators/validate_utf8_encoding.cc +++ b/src/operators/validate_utf8_encoding.cc @@ -126,58 +126,48 @@ bool ValidateUtf8Encoding::evaluate(Transaction *transaction, Rule *rule, switch (rc) { case UNICODE_ERROR_CHARACTERS_MISSING : if (transaction) { -#ifndef NO_LOGS - transaction->debug(8, "Invalid UTF-8 encoding: " + ms_dbg_a(transaction, 8, "Invalid UTF-8 encoding: " "not enough bytes in character " "at " + str + ". [offset \"" + std::to_string(i) + "\"]"); -#endif } return true; break; case UNICODE_ERROR_INVALID_ENCODING : if (transaction) { -#ifndef NO_LOGS - transaction->debug(8, "Invalid UTF-8 encoding: " + ms_dbg_a(transaction, 8, "Invalid UTF-8 encoding: " "invalid byte value in character " "at " + str + ". [offset \"" + std::to_string(i) + "\"]"); -#endif logOffset(ruleMessage, i, str.size()); } return true; break; case UNICODE_ERROR_OVERLONG_CHARACTER : if (transaction) { -#ifndef NO_LOGS - transaction->debug(8, "Invalid UTF-8 encoding: " + ms_dbg_a(transaction, 8, "Invalid UTF-8 encoding: " "overlong character detected " "at " + str + ". [offset \"" + std::to_string(i) + "\"]"); -#endif logOffset(ruleMessage, i, str.size()); } return true; break; case UNICODE_ERROR_RESTRICTED_CHARACTER : if (transaction) { -#ifndef NO_LOGS - transaction->debug(8, "Invalid UTF-8 encoding: " + ms_dbg_a(transaction, 8, "Invalid UTF-8 encoding: " "use of restricted character " "at " + str + ". [offset \"" + std::to_string(i) + "\"]"); -#endif logOffset(ruleMessage, i, str.size()); } return true; break; case UNICODE_ERROR_DECODING_ERROR : if (transaction) { -#ifndef NO_LOGS - transaction->debug(8, "Error validating UTF-8 decoding " + ms_dbg_a(transaction, 8, "Error validating UTF-8 decoding " "at " + str + ". [offset \"" + std::to_string(i) + "\"]"); -#endif logOffset(ruleMessage, i, str.size()); } return true; @@ -186,11 +176,9 @@ bool ValidateUtf8Encoding::evaluate(Transaction *transaction, Rule *rule, if (rc <= 0) { if (transaction) { -#ifndef NO_LOGS - transaction->debug(8, "Internal error during UTF-8 validation " + ms_dbg_a(transaction, 8, "Internal error during UTF-8 validation " "at " + str + ". [offset \"" + std::to_string(i) + "\"]"); -#endif logOffset(ruleMessage, i, str.size()); } return true; diff --git a/src/operators/verify_cc.cc b/src/operators/verify_cc.cc index e3311fe0..76231776 100644 --- a/src/operators/verify_cc.cc +++ b/src/operators/verify_cc.cc @@ -145,16 +145,12 @@ bool VerifyCC::evaluate(Transaction *t, Rule *rule, if (rule && t && rule->m_containsCaptureAction) { t->m_collections.m_tx_collection->storeOrUpdateFirst( "0", std::string(match)); -#ifndef NO_LOGS - t->debug(7, "Added VerifyCC match TX.0: " + \ + ms_dbg_a(t, 7, "Added VerifyCC match TX.0: " + \ std::string(match)); -#endif } -#ifndef NO_LOGS - t->debug(9, "CC# match \"" + m_param + + ms_dbg_a(t, 9, "CC# match \"" + m_param + "\" at " + i + ". [offset " + std::to_string(offset) + "]"); -#endif } return true; } diff --git a/src/operators/verify_cpf.cc b/src/operators/verify_cpf.cc index 9c7d403c..10b26291 100644 --- a/src/operators/verify_cpf.cc +++ b/src/operators/verify_cpf.cc @@ -136,10 +136,8 @@ bool VerifyCPF::evaluate(Transaction *t, Rule *rule, if (rule && t && rule->m_containsCaptureAction) { t->m_collections.m_tx_collection->storeOrUpdateFirst( "0", std::string(i.match)); -#ifndef NO_LOGS - t->debug(7, "Added VerifyCPF match TX.0: " + \ + ms_dbg_a(t, 7, "Added VerifyCPF match TX.0: " + \ std::string(i.match)); -#endif } goto out; diff --git a/src/operators/verify_ssn.cc b/src/operators/verify_ssn.cc index 88e7c084..150b2aa2 100644 --- a/src/operators/verify_ssn.cc +++ b/src/operators/verify_ssn.cc @@ -127,10 +127,8 @@ bool VerifySSN::evaluate(Transaction *t, Rule *rule, if (rule && t && rule->m_containsCaptureAction) { t->m_collections.m_tx_collection->storeOrUpdateFirst( "0", std::string(i.match)); -#ifndef NO_LOGS - t->debug(7, "Added VerifySSN match TX.0: " + \ + ms_dbg_a(t, 7, "Added VerifySSN match TX.0: " + \ std::string(i.match)); -#endif } goto out; diff --git a/src/parser/seclang-parser.cc b/src/parser/seclang-parser.cc index 054b2c3f..0e35179e 100644 --- a/src/parser/seclang-parser.cc +++ b/src/parser/seclang-parser.cc @@ -2930,6 +2930,8 @@ namespace yy { driver.m_unicodeMapTable.m_set = true; driver.m_unicodeMapTable.m_unicode_map_table = static_cast(malloc(sizeof(int) * 65536)); + // FIXME: that deservers to have its own file. Too much code to be here. + if (driver.m_unicodeMapTable.m_unicode_map_table == NULL) { std::stringstream ss; ss << "Failed to allocate memory for the unicode map file - " << yystack_[0].value.as< std::string > () << " "; @@ -2986,31 +2988,31 @@ namespace yy { p = strtok_r(NULL,CODEPAGE_SEPARATORS,&savedptr); } } -#line 2990 "seclang-parser.cc" // lalr1.cc:870 +#line 2992 "seclang-parser.cc" // lalr1.cc:870 break; case 150: -#line 1807 "seclang-parser.yy" // lalr1.cc:870 +#line 1809 "seclang-parser.yy" // lalr1.cc:870 { /* Parser error disabled to avoid breaking default CRS installations with crs-setup.conf-recommended driver.error(@0, "SecCollectionTimeout is not yet supported."); YYERROR; */ } -#line 3001 "seclang-parser.cc" // lalr1.cc:870 +#line 3003 "seclang-parser.cc" // lalr1.cc:870 break; case 151: -#line 1814 "seclang-parser.yy" // lalr1.cc:870 +#line 1816 "seclang-parser.yy" // lalr1.cc:870 { driver.m_httpblKey.m_set = true; driver.m_httpblKey.m_value = yystack_[0].value.as< std::string > (); } -#line 3010 "seclang-parser.cc" // lalr1.cc:870 +#line 3012 "seclang-parser.cc" // lalr1.cc:870 break; case 152: -#line 1822 "seclang-parser.yy" // lalr1.cc:870 +#line 1824 "seclang-parser.yy" // lalr1.cc:870 { std::unique_ptr > > originalList = std::move(yystack_[0].value.as< std::unique_ptr > > > ()); std::unique_ptr>> newList(new std::vector>()); @@ -3044,2364 +3046,2364 @@ namespace yy { } yylhs.value.as< std::unique_ptr > > > () = std::move(newNewList); } -#line 3048 "seclang-parser.cc" // lalr1.cc:870 +#line 3050 "seclang-parser.cc" // lalr1.cc:870 break; case 153: -#line 1859 "seclang-parser.yy" // lalr1.cc:870 +#line 1861 "seclang-parser.yy" // lalr1.cc:870 { yylhs.value.as< std::unique_ptr > > > () = std::move(yystack_[0].value.as< std::unique_ptr > > > ()); } -#line 3056 "seclang-parser.cc" // lalr1.cc:870 +#line 3058 "seclang-parser.cc" // lalr1.cc:870 break; case 154: -#line 1863 "seclang-parser.yy" // lalr1.cc:870 +#line 1865 "seclang-parser.yy" // lalr1.cc:870 { yylhs.value.as< std::unique_ptr > > > () = std::move(yystack_[1].value.as< std::unique_ptr > > > ()); } -#line 3064 "seclang-parser.cc" // lalr1.cc:870 +#line 3066 "seclang-parser.cc" // lalr1.cc:870 break; case 155: -#line 1870 "seclang-parser.yy" // lalr1.cc:870 +#line 1872 "seclang-parser.yy" // lalr1.cc:870 { yystack_[2].value.as< std::unique_ptr > > > ()->push_back(std::move(yystack_[0].value.as< std::unique_ptr > ())); yylhs.value.as< std::unique_ptr > > > () = std::move(yystack_[2].value.as< std::unique_ptr > > > ()); } -#line 3073 "seclang-parser.cc" // lalr1.cc:870 +#line 3075 "seclang-parser.cc" // lalr1.cc:870 break; case 156: -#line 1875 "seclang-parser.yy" // lalr1.cc:870 +#line 1877 "seclang-parser.yy" // lalr1.cc:870 { std::unique_ptr c(new VariableModificatorExclusion(std::move(yystack_[0].value.as< std::unique_ptr > ()))); yystack_[3].value.as< std::unique_ptr > > > ()->push_back(std::move(c)); yylhs.value.as< std::unique_ptr > > > () = std::move(yystack_[3].value.as< std::unique_ptr > > > ()); } -#line 3083 "seclang-parser.cc" // lalr1.cc:870 +#line 3085 "seclang-parser.cc" // lalr1.cc:870 break; case 157: -#line 1881 "seclang-parser.yy" // lalr1.cc:870 +#line 1883 "seclang-parser.yy" // lalr1.cc:870 { std::unique_ptr c(new VariableModificatorCount(std::move(yystack_[0].value.as< std::unique_ptr > ()))); yystack_[3].value.as< std::unique_ptr > > > ()->push_back(std::move(c)); yylhs.value.as< std::unique_ptr > > > () = std::move(yystack_[3].value.as< std::unique_ptr > > > ()); } -#line 3093 "seclang-parser.cc" // lalr1.cc:870 +#line 3095 "seclang-parser.cc" // lalr1.cc:870 break; case 158: -#line 1887 "seclang-parser.yy" // lalr1.cc:870 +#line 1889 "seclang-parser.yy" // lalr1.cc:870 { std::unique_ptr>> b(new std::vector>()); b->push_back(std::move(yystack_[0].value.as< std::unique_ptr > ())); yylhs.value.as< std::unique_ptr > > > () = std::move(b); } -#line 3103 "seclang-parser.cc" // lalr1.cc:870 +#line 3105 "seclang-parser.cc" // lalr1.cc:870 break; case 159: -#line 1893 "seclang-parser.yy" // lalr1.cc:870 +#line 1895 "seclang-parser.yy" // lalr1.cc:870 { std::unique_ptr>> b(new std::vector>()); std::unique_ptr c(new VariableModificatorExclusion(std::move(yystack_[0].value.as< std::unique_ptr > ()))); b->push_back(std::move(c)); yylhs.value.as< std::unique_ptr > > > () = std::move(b); } -#line 3114 "seclang-parser.cc" // lalr1.cc:870 +#line 3116 "seclang-parser.cc" // lalr1.cc:870 break; case 160: -#line 1900 "seclang-parser.yy" // lalr1.cc:870 +#line 1902 "seclang-parser.yy" // lalr1.cc:870 { std::unique_ptr>> b(new std::vector>()); std::unique_ptr c(new VariableModificatorCount(std::move(yystack_[0].value.as< std::unique_ptr > ()))); b->push_back(std::move(c)); yylhs.value.as< std::unique_ptr > > > () = std::move(b); } -#line 3125 "seclang-parser.cc" // lalr1.cc:870 +#line 3127 "seclang-parser.cc" // lalr1.cc:870 break; case 161: -#line 1910 "seclang-parser.yy" // lalr1.cc:870 +#line 1912 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Args_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3133 "seclang-parser.cc" // lalr1.cc:870 +#line 3135 "seclang-parser.cc" // lalr1.cc:870 break; case 162: -#line 1914 "seclang-parser.yy" // lalr1.cc:870 +#line 1916 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Args_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3141 "seclang-parser.cc" // lalr1.cc:870 +#line 3143 "seclang-parser.cc" // lalr1.cc:870 break; case 163: -#line 1918 "seclang-parser.yy" // lalr1.cc:870 +#line 1920 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Args_NoDictElement()); } -#line 3149 "seclang-parser.cc" // lalr1.cc:870 +#line 3151 "seclang-parser.cc" // lalr1.cc:870 break; case 164: -#line 1922 "seclang-parser.yy" // lalr1.cc:870 +#line 1924 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ArgsPost_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3157 "seclang-parser.cc" // lalr1.cc:870 +#line 3159 "seclang-parser.cc" // lalr1.cc:870 break; case 165: -#line 1926 "seclang-parser.yy" // lalr1.cc:870 +#line 1928 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ArgsPost_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3165 "seclang-parser.cc" // lalr1.cc:870 +#line 3167 "seclang-parser.cc" // lalr1.cc:870 break; case 166: -#line 1930 "seclang-parser.yy" // lalr1.cc:870 +#line 1932 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ArgsPost_NoDictElement()); } -#line 3173 "seclang-parser.cc" // lalr1.cc:870 +#line 3175 "seclang-parser.cc" // lalr1.cc:870 break; case 167: -#line 1934 "seclang-parser.yy" // lalr1.cc:870 +#line 1936 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ArgsGet_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3181 "seclang-parser.cc" // lalr1.cc:870 +#line 3183 "seclang-parser.cc" // lalr1.cc:870 break; case 168: -#line 1938 "seclang-parser.yy" // lalr1.cc:870 +#line 1940 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ArgsGet_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3189 "seclang-parser.cc" // lalr1.cc:870 +#line 3191 "seclang-parser.cc" // lalr1.cc:870 break; case 169: -#line 1942 "seclang-parser.yy" // lalr1.cc:870 +#line 1944 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ArgsGet_NoDictElement()); } -#line 3197 "seclang-parser.cc" // lalr1.cc:870 +#line 3199 "seclang-parser.cc" // lalr1.cc:870 break; case 170: -#line 1946 "seclang-parser.yy" // lalr1.cc:870 +#line 1948 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::FilesSizes_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3205 "seclang-parser.cc" // lalr1.cc:870 +#line 3207 "seclang-parser.cc" // lalr1.cc:870 break; case 171: -#line 1950 "seclang-parser.yy" // lalr1.cc:870 +#line 1952 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::FilesSizes_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3213 "seclang-parser.cc" // lalr1.cc:870 +#line 3215 "seclang-parser.cc" // lalr1.cc:870 break; case 172: -#line 1954 "seclang-parser.yy" // lalr1.cc:870 +#line 1956 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::FilesSizes_NoDictElement()); } -#line 3221 "seclang-parser.cc" // lalr1.cc:870 +#line 3223 "seclang-parser.cc" // lalr1.cc:870 break; case 173: -#line 1958 "seclang-parser.yy" // lalr1.cc:870 +#line 1960 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::FilesNames_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3229 "seclang-parser.cc" // lalr1.cc:870 +#line 3231 "seclang-parser.cc" // lalr1.cc:870 break; case 174: -#line 1962 "seclang-parser.yy" // lalr1.cc:870 +#line 1964 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::FilesNames_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3237 "seclang-parser.cc" // lalr1.cc:870 +#line 3239 "seclang-parser.cc" // lalr1.cc:870 break; case 175: -#line 1966 "seclang-parser.yy" // lalr1.cc:870 +#line 1968 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::FilesNames_NoDictElement()); } -#line 3245 "seclang-parser.cc" // lalr1.cc:870 +#line 3247 "seclang-parser.cc" // lalr1.cc:870 break; case 176: -#line 1970 "seclang-parser.yy" // lalr1.cc:870 +#line 1972 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::FilesTmpContent_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3253 "seclang-parser.cc" // lalr1.cc:870 +#line 3255 "seclang-parser.cc" // lalr1.cc:870 break; case 177: -#line 1974 "seclang-parser.yy" // lalr1.cc:870 +#line 1976 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::FilesTmpContent_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3261 "seclang-parser.cc" // lalr1.cc:870 +#line 3263 "seclang-parser.cc" // lalr1.cc:870 break; case 178: -#line 1978 "seclang-parser.yy" // lalr1.cc:870 +#line 1980 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::FilesTmpContent_NoDictElement()); } -#line 3269 "seclang-parser.cc" // lalr1.cc:870 +#line 3271 "seclang-parser.cc" // lalr1.cc:870 break; case 179: -#line 1982 "seclang-parser.yy" // lalr1.cc:870 +#line 1984 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MultiPartFileName_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3277 "seclang-parser.cc" // lalr1.cc:870 +#line 3279 "seclang-parser.cc" // lalr1.cc:870 break; case 180: -#line 1986 "seclang-parser.yy" // lalr1.cc:870 +#line 1988 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MultiPartFileName_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3285 "seclang-parser.cc" // lalr1.cc:870 +#line 3287 "seclang-parser.cc" // lalr1.cc:870 break; case 181: -#line 1990 "seclang-parser.yy" // lalr1.cc:870 +#line 1992 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MultiPartFileName_NoDictElement()); } -#line 3293 "seclang-parser.cc" // lalr1.cc:870 +#line 3295 "seclang-parser.cc" // lalr1.cc:870 break; case 182: -#line 1994 "seclang-parser.yy" // lalr1.cc:870 +#line 1996 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MultiPartName_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3301 "seclang-parser.cc" // lalr1.cc:870 +#line 3303 "seclang-parser.cc" // lalr1.cc:870 break; case 183: -#line 1998 "seclang-parser.yy" // lalr1.cc:870 +#line 2000 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MultiPartName_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3309 "seclang-parser.cc" // lalr1.cc:870 +#line 3311 "seclang-parser.cc" // lalr1.cc:870 break; case 184: -#line 2002 "seclang-parser.yy" // lalr1.cc:870 +#line 2004 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MultiPartName_NoDictElement()); } -#line 3317 "seclang-parser.cc" // lalr1.cc:870 +#line 3319 "seclang-parser.cc" // lalr1.cc:870 break; case 185: -#line 2006 "seclang-parser.yy" // lalr1.cc:870 +#line 2008 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MatchedVarsNames_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3325 "seclang-parser.cc" // lalr1.cc:870 +#line 3327 "seclang-parser.cc" // lalr1.cc:870 break; case 186: -#line 2010 "seclang-parser.yy" // lalr1.cc:870 +#line 2012 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MatchedVarsNames_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3333 "seclang-parser.cc" // lalr1.cc:870 +#line 3335 "seclang-parser.cc" // lalr1.cc:870 break; case 187: -#line 2014 "seclang-parser.yy" // lalr1.cc:870 +#line 2016 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MatchedVarsNames_NoDictElement()); } -#line 3341 "seclang-parser.cc" // lalr1.cc:870 +#line 3343 "seclang-parser.cc" // lalr1.cc:870 break; case 188: -#line 2018 "seclang-parser.yy" // lalr1.cc:870 +#line 2020 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MatchedVars_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3349 "seclang-parser.cc" // lalr1.cc:870 +#line 3351 "seclang-parser.cc" // lalr1.cc:870 break; case 189: -#line 2022 "seclang-parser.yy" // lalr1.cc:870 +#line 2024 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MatchedVars_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3357 "seclang-parser.cc" // lalr1.cc:870 +#line 3359 "seclang-parser.cc" // lalr1.cc:870 break; case 190: -#line 2026 "seclang-parser.yy" // lalr1.cc:870 +#line 2028 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MatchedVars_NoDictElement()); } -#line 3365 "seclang-parser.cc" // lalr1.cc:870 +#line 3367 "seclang-parser.cc" // lalr1.cc:870 break; case 191: -#line 2030 "seclang-parser.yy" // lalr1.cc:870 +#line 2032 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Files_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3373 "seclang-parser.cc" // lalr1.cc:870 +#line 3375 "seclang-parser.cc" // lalr1.cc:870 break; case 192: -#line 2034 "seclang-parser.yy" // lalr1.cc:870 +#line 2036 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Files_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3381 "seclang-parser.cc" // lalr1.cc:870 +#line 3383 "seclang-parser.cc" // lalr1.cc:870 break; case 193: -#line 2038 "seclang-parser.yy" // lalr1.cc:870 +#line 2040 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Files_NoDictElement()); } -#line 3389 "seclang-parser.cc" // lalr1.cc:870 +#line 3391 "seclang-parser.cc" // lalr1.cc:870 break; case 194: -#line 2042 "seclang-parser.yy" // lalr1.cc:870 +#line 2044 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::RequestCookies_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3397 "seclang-parser.cc" // lalr1.cc:870 +#line 3399 "seclang-parser.cc" // lalr1.cc:870 break; case 195: -#line 2046 "seclang-parser.yy" // lalr1.cc:870 +#line 2048 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::RequestCookies_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3405 "seclang-parser.cc" // lalr1.cc:870 +#line 3407 "seclang-parser.cc" // lalr1.cc:870 break; case 196: -#line 2050 "seclang-parser.yy" // lalr1.cc:870 +#line 2052 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::RequestCookies_NoDictElement()); } -#line 3413 "seclang-parser.cc" // lalr1.cc:870 +#line 3415 "seclang-parser.cc" // lalr1.cc:870 break; case 197: -#line 2054 "seclang-parser.yy" // lalr1.cc:870 +#line 2056 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::RequestHeaders_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3421 "seclang-parser.cc" // lalr1.cc:870 +#line 3423 "seclang-parser.cc" // lalr1.cc:870 break; case 198: -#line 2058 "seclang-parser.yy" // lalr1.cc:870 +#line 2060 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::RequestHeaders_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3429 "seclang-parser.cc" // lalr1.cc:870 +#line 3431 "seclang-parser.cc" // lalr1.cc:870 break; case 199: -#line 2062 "seclang-parser.yy" // lalr1.cc:870 +#line 2064 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::RequestHeaders_NoDictElement()); } -#line 3437 "seclang-parser.cc" // lalr1.cc:870 +#line 3439 "seclang-parser.cc" // lalr1.cc:870 break; case 200: -#line 2066 "seclang-parser.yy" // lalr1.cc:870 +#line 2068 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ResponseHeaders_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3445 "seclang-parser.cc" // lalr1.cc:870 +#line 3447 "seclang-parser.cc" // lalr1.cc:870 break; case 201: -#line 2070 "seclang-parser.yy" // lalr1.cc:870 +#line 2072 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ResponseHeaders_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3453 "seclang-parser.cc" // lalr1.cc:870 +#line 3455 "seclang-parser.cc" // lalr1.cc:870 break; case 202: -#line 2074 "seclang-parser.yy" // lalr1.cc:870 +#line 2076 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ResponseHeaders_NoDictElement()); } -#line 3461 "seclang-parser.cc" // lalr1.cc:870 +#line 3463 "seclang-parser.cc" // lalr1.cc:870 break; case 203: -#line 2078 "seclang-parser.yy" // lalr1.cc:870 +#line 2080 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Geo_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3469 "seclang-parser.cc" // lalr1.cc:870 +#line 3471 "seclang-parser.cc" // lalr1.cc:870 break; case 204: -#line 2082 "seclang-parser.yy" // lalr1.cc:870 +#line 2084 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Geo_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3477 "seclang-parser.cc" // lalr1.cc:870 +#line 3479 "seclang-parser.cc" // lalr1.cc:870 break; case 205: -#line 2086 "seclang-parser.yy" // lalr1.cc:870 +#line 2088 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Geo_NoDictElement()); } -#line 3485 "seclang-parser.cc" // lalr1.cc:870 +#line 3487 "seclang-parser.cc" // lalr1.cc:870 break; case 206: -#line 2090 "seclang-parser.yy" // lalr1.cc:870 +#line 2092 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::RequestCookiesNames_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3493 "seclang-parser.cc" // lalr1.cc:870 +#line 3495 "seclang-parser.cc" // lalr1.cc:870 break; case 207: -#line 2094 "seclang-parser.yy" // lalr1.cc:870 +#line 2096 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::RequestCookiesNames_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3501 "seclang-parser.cc" // lalr1.cc:870 +#line 3503 "seclang-parser.cc" // lalr1.cc:870 break; case 208: -#line 2098 "seclang-parser.yy" // lalr1.cc:870 +#line 2100 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::RequestCookiesNames_NoDictElement()); } -#line 3509 "seclang-parser.cc" // lalr1.cc:870 +#line 3511 "seclang-parser.cc" // lalr1.cc:870 break; case 209: -#line 2102 "seclang-parser.yy" // lalr1.cc:870 +#line 2104 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Rule_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3517 "seclang-parser.cc" // lalr1.cc:870 +#line 3519 "seclang-parser.cc" // lalr1.cc:870 break; case 210: -#line 2106 "seclang-parser.yy" // lalr1.cc:870 +#line 2108 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Rule_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3525 "seclang-parser.cc" // lalr1.cc:870 +#line 3527 "seclang-parser.cc" // lalr1.cc:870 break; case 211: -#line 2110 "seclang-parser.yy" // lalr1.cc:870 +#line 2112 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Rule_NoDictElement()); } -#line 3533 "seclang-parser.cc" // lalr1.cc:870 +#line 3535 "seclang-parser.cc" // lalr1.cc:870 break; case 212: -#line 2114 "seclang-parser.yy" // lalr1.cc:870 +#line 2116 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Env("ENV:" + yystack_[0].value.as< std::string > ())); } -#line 3541 "seclang-parser.cc" // lalr1.cc:870 +#line 3543 "seclang-parser.cc" // lalr1.cc:870 break; case 213: -#line 2118 "seclang-parser.yy" // lalr1.cc:870 +#line 2120 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Env("ENV:" + yystack_[0].value.as< std::string > ())); } -#line 3549 "seclang-parser.cc" // lalr1.cc:870 +#line 3551 "seclang-parser.cc" // lalr1.cc:870 break; case 214: -#line 2122 "seclang-parser.yy" // lalr1.cc:870 +#line 2124 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Env("ENV")); } -#line 3557 "seclang-parser.cc" // lalr1.cc:870 +#line 3559 "seclang-parser.cc" // lalr1.cc:870 break; case 215: -#line 2126 "seclang-parser.yy" // lalr1.cc:870 +#line 2128 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::XML("XML:" + yystack_[0].value.as< std::string > ())); } -#line 3565 "seclang-parser.cc" // lalr1.cc:870 +#line 3567 "seclang-parser.cc" // lalr1.cc:870 break; case 216: -#line 2130 "seclang-parser.yy" // lalr1.cc:870 +#line 2132 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::XML("XML:" + yystack_[0].value.as< std::string > ())); } -#line 3573 "seclang-parser.cc" // lalr1.cc:870 +#line 3575 "seclang-parser.cc" // lalr1.cc:870 break; case 217: -#line 2134 "seclang-parser.yy" // lalr1.cc:870 +#line 2136 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::XML_NoDictElement()); } -#line 3581 "seclang-parser.cc" // lalr1.cc:870 +#line 3583 "seclang-parser.cc" // lalr1.cc:870 break; case 218: -#line 2138 "seclang-parser.yy" // lalr1.cc:870 +#line 2140 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::FilesTmpNames_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3589 "seclang-parser.cc" // lalr1.cc:870 +#line 3591 "seclang-parser.cc" // lalr1.cc:870 break; case 219: -#line 2142 "seclang-parser.yy" // lalr1.cc:870 +#line 2144 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::FilesTmpNames_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3597 "seclang-parser.cc" // lalr1.cc:870 +#line 3599 "seclang-parser.cc" // lalr1.cc:870 break; case 220: -#line 2146 "seclang-parser.yy" // lalr1.cc:870 +#line 2148 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::FilesTmpNames_NoDictElement()); } -#line 3605 "seclang-parser.cc" // lalr1.cc:870 +#line 3607 "seclang-parser.cc" // lalr1.cc:870 break; case 221: -#line 2150 "seclang-parser.yy" // lalr1.cc:870 +#line 2152 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Resource_DynamicElement(std::move(yystack_[0].value.as< std::unique_ptr > ()))); } -#line 3613 "seclang-parser.cc" // lalr1.cc:870 +#line 3615 "seclang-parser.cc" // lalr1.cc:870 break; case 222: -#line 2154 "seclang-parser.yy" // lalr1.cc:870 +#line 2156 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Resource_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3621 "seclang-parser.cc" // lalr1.cc:870 +#line 3623 "seclang-parser.cc" // lalr1.cc:870 break; case 223: -#line 2158 "seclang-parser.yy" // lalr1.cc:870 +#line 2160 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Resource_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3629 "seclang-parser.cc" // lalr1.cc:870 +#line 3631 "seclang-parser.cc" // lalr1.cc:870 break; case 224: -#line 2162 "seclang-parser.yy" // lalr1.cc:870 +#line 2164 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Resource_NoDictElement()); } -#line 3637 "seclang-parser.cc" // lalr1.cc:870 +#line 3639 "seclang-parser.cc" // lalr1.cc:870 break; case 225: -#line 2166 "seclang-parser.yy" // lalr1.cc:870 +#line 2168 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Ip_DynamicElement(std::move(yystack_[0].value.as< std::unique_ptr > ()))); } -#line 3645 "seclang-parser.cc" // lalr1.cc:870 +#line 3647 "seclang-parser.cc" // lalr1.cc:870 break; case 226: -#line 2170 "seclang-parser.yy" // lalr1.cc:870 +#line 2172 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Ip_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3653 "seclang-parser.cc" // lalr1.cc:870 +#line 3655 "seclang-parser.cc" // lalr1.cc:870 break; case 227: -#line 2174 "seclang-parser.yy" // lalr1.cc:870 +#line 2176 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Ip_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3661 "seclang-parser.cc" // lalr1.cc:870 +#line 3663 "seclang-parser.cc" // lalr1.cc:870 break; case 228: -#line 2178 "seclang-parser.yy" // lalr1.cc:870 +#line 2180 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Ip_NoDictElement()); } -#line 3669 "seclang-parser.cc" // lalr1.cc:870 +#line 3671 "seclang-parser.cc" // lalr1.cc:870 break; case 229: -#line 2182 "seclang-parser.yy" // lalr1.cc:870 +#line 2184 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Global_DynamicElement(std::move(yystack_[0].value.as< std::unique_ptr > ()))); } -#line 3677 "seclang-parser.cc" // lalr1.cc:870 +#line 3679 "seclang-parser.cc" // lalr1.cc:870 break; case 230: -#line 2186 "seclang-parser.yy" // lalr1.cc:870 +#line 2188 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Global_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3685 "seclang-parser.cc" // lalr1.cc:870 +#line 3687 "seclang-parser.cc" // lalr1.cc:870 break; case 231: -#line 2190 "seclang-parser.yy" // lalr1.cc:870 +#line 2192 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Global_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3693 "seclang-parser.cc" // lalr1.cc:870 +#line 3695 "seclang-parser.cc" // lalr1.cc:870 break; case 232: -#line 2194 "seclang-parser.yy" // lalr1.cc:870 +#line 2196 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Global_NoDictElement()); } -#line 3701 "seclang-parser.cc" // lalr1.cc:870 +#line 3703 "seclang-parser.cc" // lalr1.cc:870 break; case 233: -#line 2198 "seclang-parser.yy" // lalr1.cc:870 +#line 2200 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::User_DynamicElement(std::move(yystack_[0].value.as< std::unique_ptr > ()))); } -#line 3709 "seclang-parser.cc" // lalr1.cc:870 +#line 3711 "seclang-parser.cc" // lalr1.cc:870 break; case 234: -#line 2202 "seclang-parser.yy" // lalr1.cc:870 +#line 2204 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::User_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3717 "seclang-parser.cc" // lalr1.cc:870 +#line 3719 "seclang-parser.cc" // lalr1.cc:870 break; case 235: -#line 2206 "seclang-parser.yy" // lalr1.cc:870 +#line 2208 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::User_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3725 "seclang-parser.cc" // lalr1.cc:870 +#line 3727 "seclang-parser.cc" // lalr1.cc:870 break; case 236: -#line 2210 "seclang-parser.yy" // lalr1.cc:870 +#line 2212 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::User_NoDictElement()); } -#line 3733 "seclang-parser.cc" // lalr1.cc:870 +#line 3735 "seclang-parser.cc" // lalr1.cc:870 break; case 237: -#line 2214 "seclang-parser.yy" // lalr1.cc:870 +#line 2216 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Tx_DynamicElement(std::move(yystack_[0].value.as< std::unique_ptr > ()))); } -#line 3741 "seclang-parser.cc" // lalr1.cc:870 +#line 3743 "seclang-parser.cc" // lalr1.cc:870 break; case 238: -#line 2218 "seclang-parser.yy" // lalr1.cc:870 +#line 2220 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Tx_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3749 "seclang-parser.cc" // lalr1.cc:870 +#line 3751 "seclang-parser.cc" // lalr1.cc:870 break; case 239: -#line 2222 "seclang-parser.yy" // lalr1.cc:870 +#line 2224 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Tx_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3757 "seclang-parser.cc" // lalr1.cc:870 +#line 3759 "seclang-parser.cc" // lalr1.cc:870 break; case 240: -#line 2226 "seclang-parser.yy" // lalr1.cc:870 +#line 2228 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Tx_NoDictElement()); } -#line 3765 "seclang-parser.cc" // lalr1.cc:870 +#line 3767 "seclang-parser.cc" // lalr1.cc:870 break; case 241: -#line 2230 "seclang-parser.yy" // lalr1.cc:870 +#line 2232 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Session_DynamicElement(std::move(yystack_[0].value.as< std::unique_ptr > ()))); } -#line 3773 "seclang-parser.cc" // lalr1.cc:870 +#line 3775 "seclang-parser.cc" // lalr1.cc:870 break; case 242: -#line 2234 "seclang-parser.yy" // lalr1.cc:870 +#line 2236 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Session_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3781 "seclang-parser.cc" // lalr1.cc:870 +#line 3783 "seclang-parser.cc" // lalr1.cc:870 break; case 243: -#line 2238 "seclang-parser.yy" // lalr1.cc:870 +#line 2240 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Session_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3789 "seclang-parser.cc" // lalr1.cc:870 +#line 3791 "seclang-parser.cc" // lalr1.cc:870 break; case 244: -#line 2242 "seclang-parser.yy" // lalr1.cc:870 +#line 2244 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Session_NoDictElement()); } -#line 3797 "seclang-parser.cc" // lalr1.cc:870 +#line 3799 "seclang-parser.cc" // lalr1.cc:870 break; case 245: -#line 2246 "seclang-parser.yy" // lalr1.cc:870 +#line 2248 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ArgsNames_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3805 "seclang-parser.cc" // lalr1.cc:870 +#line 3807 "seclang-parser.cc" // lalr1.cc:870 break; case 246: -#line 2250 "seclang-parser.yy" // lalr1.cc:870 +#line 2252 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ArgsNames_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3813 "seclang-parser.cc" // lalr1.cc:870 +#line 3815 "seclang-parser.cc" // lalr1.cc:870 break; case 247: -#line 2254 "seclang-parser.yy" // lalr1.cc:870 +#line 2256 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ArgsNames_NoDictElement()); } -#line 3821 "seclang-parser.cc" // lalr1.cc:870 +#line 3823 "seclang-parser.cc" // lalr1.cc:870 break; case 248: -#line 2258 "seclang-parser.yy" // lalr1.cc:870 +#line 2260 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ArgsGetNames_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3829 "seclang-parser.cc" // lalr1.cc:870 +#line 3831 "seclang-parser.cc" // lalr1.cc:870 break; case 249: -#line 2262 "seclang-parser.yy" // lalr1.cc:870 +#line 2264 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ArgsGetNames_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3837 "seclang-parser.cc" // lalr1.cc:870 +#line 3839 "seclang-parser.cc" // lalr1.cc:870 break; case 250: -#line 2266 "seclang-parser.yy" // lalr1.cc:870 +#line 2268 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ArgsGetNames_NoDictElement()); } -#line 3845 "seclang-parser.cc" // lalr1.cc:870 +#line 3847 "seclang-parser.cc" // lalr1.cc:870 break; case 251: -#line 2271 "seclang-parser.yy" // lalr1.cc:870 +#line 2273 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ArgsPostNames_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3853 "seclang-parser.cc" // lalr1.cc:870 +#line 3855 "seclang-parser.cc" // lalr1.cc:870 break; case 252: -#line 2275 "seclang-parser.yy" // lalr1.cc:870 +#line 2277 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ArgsPostNames_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3861 "seclang-parser.cc" // lalr1.cc:870 +#line 3863 "seclang-parser.cc" // lalr1.cc:870 break; case 253: -#line 2279 "seclang-parser.yy" // lalr1.cc:870 +#line 2281 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ArgsPostNames_NoDictElement()); } -#line 3869 "seclang-parser.cc" // lalr1.cc:870 +#line 3871 "seclang-parser.cc" // lalr1.cc:870 break; case 254: -#line 2284 "seclang-parser.yy" // lalr1.cc:870 +#line 2286 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::RequestHeadersNames_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3877 "seclang-parser.cc" // lalr1.cc:870 +#line 3879 "seclang-parser.cc" // lalr1.cc:870 break; case 255: -#line 2288 "seclang-parser.yy" // lalr1.cc:870 +#line 2290 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::RequestHeadersNames_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3885 "seclang-parser.cc" // lalr1.cc:870 +#line 3887 "seclang-parser.cc" // lalr1.cc:870 break; case 256: -#line 2292 "seclang-parser.yy" // lalr1.cc:870 +#line 2294 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::RequestHeadersNames_NoDictElement()); } -#line 3893 "seclang-parser.cc" // lalr1.cc:870 +#line 3895 "seclang-parser.cc" // lalr1.cc:870 break; case 257: -#line 2297 "seclang-parser.yy" // lalr1.cc:870 +#line 2299 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ResponseContentType()); } -#line 3901 "seclang-parser.cc" // lalr1.cc:870 +#line 3903 "seclang-parser.cc" // lalr1.cc:870 break; case 258: -#line 2302 "seclang-parser.yy" // lalr1.cc:870 +#line 2304 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ResponseHeadersNames_DictElement(yystack_[0].value.as< std::string > ())); } -#line 3909 "seclang-parser.cc" // lalr1.cc:870 +#line 3911 "seclang-parser.cc" // lalr1.cc:870 break; case 259: -#line 2306 "seclang-parser.yy" // lalr1.cc:870 +#line 2308 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ResponseHeadersNames_DictElementRegexp(yystack_[0].value.as< std::string > ())); } -#line 3917 "seclang-parser.cc" // lalr1.cc:870 +#line 3919 "seclang-parser.cc" // lalr1.cc:870 break; case 260: -#line 2310 "seclang-parser.yy" // lalr1.cc:870 +#line 2312 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ResponseHeadersNames_NoDictElement()); } -#line 3925 "seclang-parser.cc" // lalr1.cc:870 +#line 3927 "seclang-parser.cc" // lalr1.cc:870 break; case 261: -#line 2314 "seclang-parser.yy" // lalr1.cc:870 +#line 2316 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ArgsCombinedSize()); } -#line 3933 "seclang-parser.cc" // lalr1.cc:870 +#line 3935 "seclang-parser.cc" // lalr1.cc:870 break; case 262: -#line 2318 "seclang-parser.yy" // lalr1.cc:870 +#line 2320 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::AuthType()); } -#line 3941 "seclang-parser.cc" // lalr1.cc:870 +#line 3943 "seclang-parser.cc" // lalr1.cc:870 break; case 263: -#line 2322 "seclang-parser.yy" // lalr1.cc:870 +#line 2324 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::FilesCombinedSize()); } -#line 3949 "seclang-parser.cc" // lalr1.cc:870 +#line 3951 "seclang-parser.cc" // lalr1.cc:870 break; case 264: -#line 2326 "seclang-parser.yy" // lalr1.cc:870 +#line 2328 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::FullRequest()); } -#line 3957 "seclang-parser.cc" // lalr1.cc:870 +#line 3959 "seclang-parser.cc" // lalr1.cc:870 break; case 265: -#line 2330 "seclang-parser.yy" // lalr1.cc:870 +#line 2332 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::FullRequestLength()); } -#line 3965 "seclang-parser.cc" // lalr1.cc:870 +#line 3967 "seclang-parser.cc" // lalr1.cc:870 break; case 266: -#line 2334 "seclang-parser.yy" // lalr1.cc:870 +#line 2336 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::InboundDataError()); } -#line 3973 "seclang-parser.cc" // lalr1.cc:870 +#line 3975 "seclang-parser.cc" // lalr1.cc:870 break; case 267: -#line 2338 "seclang-parser.yy" // lalr1.cc:870 +#line 2340 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MatchedVar()); } -#line 3981 "seclang-parser.cc" // lalr1.cc:870 +#line 3983 "seclang-parser.cc" // lalr1.cc:870 break; case 268: -#line 2342 "seclang-parser.yy" // lalr1.cc:870 +#line 2344 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MatchedVarName()); } -#line 3989 "seclang-parser.cc" // lalr1.cc:870 +#line 3991 "seclang-parser.cc" // lalr1.cc:870 break; case 269: -#line 2346 "seclang-parser.yy" // lalr1.cc:870 +#line 2348 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MultipartBoundaryQuoted()); } -#line 3997 "seclang-parser.cc" // lalr1.cc:870 +#line 3999 "seclang-parser.cc" // lalr1.cc:870 break; case 270: -#line 2350 "seclang-parser.yy" // lalr1.cc:870 +#line 2352 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MultipartBoundaryWhiteSpace()); } -#line 4005 "seclang-parser.cc" // lalr1.cc:870 +#line 4007 "seclang-parser.cc" // lalr1.cc:870 break; case 271: -#line 2354 "seclang-parser.yy" // lalr1.cc:870 +#line 2356 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MultipartCrlfLFLines()); } -#line 4013 "seclang-parser.cc" // lalr1.cc:870 +#line 4015 "seclang-parser.cc" // lalr1.cc:870 break; case 272: -#line 2358 "seclang-parser.yy" // lalr1.cc:870 +#line 2360 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MultipartDateAfter()); } -#line 4021 "seclang-parser.cc" // lalr1.cc:870 +#line 4023 "seclang-parser.cc" // lalr1.cc:870 break; case 273: -#line 2362 "seclang-parser.yy" // lalr1.cc:870 +#line 2364 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MultipartDateBefore()); } -#line 4029 "seclang-parser.cc" // lalr1.cc:870 +#line 4031 "seclang-parser.cc" // lalr1.cc:870 break; case 274: -#line 2366 "seclang-parser.yy" // lalr1.cc:870 +#line 2368 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MultipartFileLimitExceeded()); } -#line 4037 "seclang-parser.cc" // lalr1.cc:870 +#line 4039 "seclang-parser.cc" // lalr1.cc:870 break; case 275: -#line 2370 "seclang-parser.yy" // lalr1.cc:870 +#line 2372 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MultipartHeaderFolding()); } -#line 4045 "seclang-parser.cc" // lalr1.cc:870 +#line 4047 "seclang-parser.cc" // lalr1.cc:870 break; case 276: -#line 2374 "seclang-parser.yy" // lalr1.cc:870 +#line 2376 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MultipartInvalidHeaderFolding()); } -#line 4053 "seclang-parser.cc" // lalr1.cc:870 +#line 4055 "seclang-parser.cc" // lalr1.cc:870 break; case 277: -#line 2378 "seclang-parser.yy" // lalr1.cc:870 +#line 2380 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MultipartInvalidPart()); } -#line 4061 "seclang-parser.cc" // lalr1.cc:870 +#line 4063 "seclang-parser.cc" // lalr1.cc:870 break; case 278: -#line 2382 "seclang-parser.yy" // lalr1.cc:870 +#line 2384 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MultipartInvalidQuoting()); } -#line 4069 "seclang-parser.cc" // lalr1.cc:870 +#line 4071 "seclang-parser.cc" // lalr1.cc:870 break; case 279: -#line 2386 "seclang-parser.yy" // lalr1.cc:870 +#line 2388 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MultipartLFLine()); } -#line 4077 "seclang-parser.cc" // lalr1.cc:870 +#line 4079 "seclang-parser.cc" // lalr1.cc:870 break; case 280: -#line 2390 "seclang-parser.yy" // lalr1.cc:870 +#line 2392 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MultipartMissingSemicolon()); } -#line 4085 "seclang-parser.cc" // lalr1.cc:870 +#line 4087 "seclang-parser.cc" // lalr1.cc:870 break; case 281: -#line 2394 "seclang-parser.yy" // lalr1.cc:870 +#line 2396 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MultipartMissingSemicolon()); } -#line 4093 "seclang-parser.cc" // lalr1.cc:870 +#line 4095 "seclang-parser.cc" // lalr1.cc:870 break; case 282: -#line 2398 "seclang-parser.yy" // lalr1.cc:870 +#line 2400 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MultipartStrictError()); } -#line 4101 "seclang-parser.cc" // lalr1.cc:870 +#line 4103 "seclang-parser.cc" // lalr1.cc:870 break; case 283: -#line 2402 "seclang-parser.yy" // lalr1.cc:870 +#line 2404 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::MultipartUnmatchedBoundary()); } -#line 4109 "seclang-parser.cc" // lalr1.cc:870 +#line 4111 "seclang-parser.cc" // lalr1.cc:870 break; case 284: -#line 2406 "seclang-parser.yy" // lalr1.cc:870 +#line 2408 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::OutboundDataError()); } -#line 4117 "seclang-parser.cc" // lalr1.cc:870 +#line 4119 "seclang-parser.cc" // lalr1.cc:870 break; case 285: -#line 2410 "seclang-parser.yy" // lalr1.cc:870 +#line 2412 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::PathInfo()); } -#line 4125 "seclang-parser.cc" // lalr1.cc:870 +#line 4127 "seclang-parser.cc" // lalr1.cc:870 break; case 286: -#line 2414 "seclang-parser.yy" // lalr1.cc:870 +#line 2416 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::QueryString()); } -#line 4133 "seclang-parser.cc" // lalr1.cc:870 +#line 4135 "seclang-parser.cc" // lalr1.cc:870 break; case 287: -#line 2418 "seclang-parser.yy" // lalr1.cc:870 +#line 2420 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::RemoteAddr()); } -#line 4141 "seclang-parser.cc" // lalr1.cc:870 +#line 4143 "seclang-parser.cc" // lalr1.cc:870 break; case 288: -#line 2422 "seclang-parser.yy" // lalr1.cc:870 +#line 2424 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::RemoteHost()); } -#line 4149 "seclang-parser.cc" // lalr1.cc:870 +#line 4151 "seclang-parser.cc" // lalr1.cc:870 break; case 289: -#line 2426 "seclang-parser.yy" // lalr1.cc:870 +#line 2428 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::RemotePort()); } -#line 4157 "seclang-parser.cc" // lalr1.cc:870 +#line 4159 "seclang-parser.cc" // lalr1.cc:870 break; case 290: -#line 2430 "seclang-parser.yy" // lalr1.cc:870 +#line 2432 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ReqbodyError()); } -#line 4165 "seclang-parser.cc" // lalr1.cc:870 +#line 4167 "seclang-parser.cc" // lalr1.cc:870 break; case 291: -#line 2434 "seclang-parser.yy" // lalr1.cc:870 +#line 2436 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ReqbodyErrorMsg()); } -#line 4173 "seclang-parser.cc" // lalr1.cc:870 +#line 4175 "seclang-parser.cc" // lalr1.cc:870 break; case 292: -#line 2438 "seclang-parser.yy" // lalr1.cc:870 +#line 2440 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ReqbodyProcessor()); } -#line 4181 "seclang-parser.cc" // lalr1.cc:870 +#line 4183 "seclang-parser.cc" // lalr1.cc:870 break; case 293: -#line 2442 "seclang-parser.yy" // lalr1.cc:870 +#line 2444 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ReqbodyProcessorError()); } -#line 4189 "seclang-parser.cc" // lalr1.cc:870 +#line 4191 "seclang-parser.cc" // lalr1.cc:870 break; case 294: -#line 2446 "seclang-parser.yy" // lalr1.cc:870 +#line 2448 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ReqbodyProcessorErrorMsg()); } -#line 4197 "seclang-parser.cc" // lalr1.cc:870 +#line 4199 "seclang-parser.cc" // lalr1.cc:870 break; case 295: -#line 2450 "seclang-parser.yy" // lalr1.cc:870 +#line 2452 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::RequestBasename()); } -#line 4205 "seclang-parser.cc" // lalr1.cc:870 +#line 4207 "seclang-parser.cc" // lalr1.cc:870 break; case 296: -#line 2454 "seclang-parser.yy" // lalr1.cc:870 +#line 2456 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::RequestBody()); } -#line 4213 "seclang-parser.cc" // lalr1.cc:870 +#line 4215 "seclang-parser.cc" // lalr1.cc:870 break; case 297: -#line 2458 "seclang-parser.yy" // lalr1.cc:870 +#line 2460 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::RequestBodyLength()); } -#line 4221 "seclang-parser.cc" // lalr1.cc:870 +#line 4223 "seclang-parser.cc" // lalr1.cc:870 break; case 298: -#line 2462 "seclang-parser.yy" // lalr1.cc:870 +#line 2464 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::RequestFilename()); } -#line 4229 "seclang-parser.cc" // lalr1.cc:870 +#line 4231 "seclang-parser.cc" // lalr1.cc:870 break; case 299: -#line 2466 "seclang-parser.yy" // lalr1.cc:870 +#line 2468 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::RequestLine()); } -#line 4237 "seclang-parser.cc" // lalr1.cc:870 +#line 4239 "seclang-parser.cc" // lalr1.cc:870 break; case 300: -#line 2470 "seclang-parser.yy" // lalr1.cc:870 +#line 2472 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::RequestMethod()); } -#line 4245 "seclang-parser.cc" // lalr1.cc:870 +#line 4247 "seclang-parser.cc" // lalr1.cc:870 break; case 301: -#line 2474 "seclang-parser.yy" // lalr1.cc:870 +#line 2476 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::RequestProtocol()); } -#line 4253 "seclang-parser.cc" // lalr1.cc:870 +#line 4255 "seclang-parser.cc" // lalr1.cc:870 break; case 302: -#line 2478 "seclang-parser.yy" // lalr1.cc:870 +#line 2480 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::RequestURI()); } -#line 4261 "seclang-parser.cc" // lalr1.cc:870 +#line 4263 "seclang-parser.cc" // lalr1.cc:870 break; case 303: -#line 2482 "seclang-parser.yy" // lalr1.cc:870 +#line 2484 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::RequestURIRaw()); } -#line 4269 "seclang-parser.cc" // lalr1.cc:870 +#line 4271 "seclang-parser.cc" // lalr1.cc:870 break; case 304: -#line 2486 "seclang-parser.yy" // lalr1.cc:870 +#line 2488 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ResponseBody()); } -#line 4277 "seclang-parser.cc" // lalr1.cc:870 +#line 4279 "seclang-parser.cc" // lalr1.cc:870 break; case 305: -#line 2490 "seclang-parser.yy" // lalr1.cc:870 +#line 2492 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ResponseContentLength()); } -#line 4285 "seclang-parser.cc" // lalr1.cc:870 +#line 4287 "seclang-parser.cc" // lalr1.cc:870 break; case 306: -#line 2494 "seclang-parser.yy" // lalr1.cc:870 +#line 2496 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ResponseProtocol()); } -#line 4293 "seclang-parser.cc" // lalr1.cc:870 +#line 4295 "seclang-parser.cc" // lalr1.cc:870 break; case 307: -#line 2498 "seclang-parser.yy" // lalr1.cc:870 +#line 2500 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ResponseStatus()); } -#line 4301 "seclang-parser.cc" // lalr1.cc:870 +#line 4303 "seclang-parser.cc" // lalr1.cc:870 break; case 308: -#line 2502 "seclang-parser.yy" // lalr1.cc:870 +#line 2504 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ServerAddr()); } -#line 4309 "seclang-parser.cc" // lalr1.cc:870 +#line 4311 "seclang-parser.cc" // lalr1.cc:870 break; case 309: -#line 2506 "seclang-parser.yy" // lalr1.cc:870 +#line 2508 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ServerName()); } -#line 4317 "seclang-parser.cc" // lalr1.cc:870 +#line 4319 "seclang-parser.cc" // lalr1.cc:870 break; case 310: -#line 2510 "seclang-parser.yy" // lalr1.cc:870 +#line 2512 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::ServerPort()); } -#line 4325 "seclang-parser.cc" // lalr1.cc:870 +#line 4327 "seclang-parser.cc" // lalr1.cc:870 break; case 311: -#line 2514 "seclang-parser.yy" // lalr1.cc:870 +#line 2516 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::SessionID()); } -#line 4333 "seclang-parser.cc" // lalr1.cc:870 +#line 4335 "seclang-parser.cc" // lalr1.cc:870 break; case 312: -#line 2518 "seclang-parser.yy" // lalr1.cc:870 +#line 2520 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::UniqueID()); } -#line 4341 "seclang-parser.cc" // lalr1.cc:870 +#line 4343 "seclang-parser.cc" // lalr1.cc:870 break; case 313: -#line 2522 "seclang-parser.yy" // lalr1.cc:870 +#line 2524 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::UrlEncodedError()); } -#line 4349 "seclang-parser.cc" // lalr1.cc:870 +#line 4351 "seclang-parser.cc" // lalr1.cc:870 break; case 314: -#line 2526 "seclang-parser.yy" // lalr1.cc:870 +#line 2528 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::UserID()); } -#line 4357 "seclang-parser.cc" // lalr1.cc:870 +#line 4359 "seclang-parser.cc" // lalr1.cc:870 break; case 315: -#line 2530 "seclang-parser.yy" // lalr1.cc:870 +#line 2532 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Status()); } -#line 4365 "seclang-parser.cc" // lalr1.cc:870 +#line 4367 "seclang-parser.cc" // lalr1.cc:870 break; case 316: -#line 2534 "seclang-parser.yy" // lalr1.cc:870 +#line 2536 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::Status()); } -#line 4373 "seclang-parser.cc" // lalr1.cc:870 +#line 4375 "seclang-parser.cc" // lalr1.cc:870 break; case 317: -#line 2538 "seclang-parser.yy" // lalr1.cc:870 +#line 2540 "seclang-parser.yy" // lalr1.cc:870 { VARIABLE_CONTAINER(yylhs.value.as< std::unique_ptr > (), new Variables::WebAppId()); } -#line 4381 "seclang-parser.cc" // lalr1.cc:870 +#line 4383 "seclang-parser.cc" // lalr1.cc:870 break; case 318: -#line 2542 "seclang-parser.yy" // lalr1.cc:870 +#line 2544 "seclang-parser.yy" // lalr1.cc:870 { std::string name(yystack_[0].value.as< std::string > ()); char z = name.at(0); std::unique_ptr c(new Duration(name)); yylhs.value.as< std::unique_ptr > () = std::move(c); } -#line 4392 "seclang-parser.cc" // lalr1.cc:870 +#line 4394 "seclang-parser.cc" // lalr1.cc:870 break; case 319: -#line 2550 "seclang-parser.yy" // lalr1.cc:870 +#line 2552 "seclang-parser.yy" // lalr1.cc:870 { std::string name(yystack_[0].value.as< std::string > ()); char z = name.at(0); std::unique_ptr c(new ModsecBuild(name)); yylhs.value.as< std::unique_ptr > () = std::move(c); } -#line 4403 "seclang-parser.cc" // lalr1.cc:870 +#line 4405 "seclang-parser.cc" // lalr1.cc:870 break; case 320: -#line 2557 "seclang-parser.yy" // lalr1.cc:870 +#line 2559 "seclang-parser.yy" // lalr1.cc:870 { std::string name(yystack_[0].value.as< std::string > ()); char z = name.at(0); std::unique_ptr c(new HighestSeverity(name)); yylhs.value.as< std::unique_ptr > () = std::move(c); } -#line 4414 "seclang-parser.cc" // lalr1.cc:870 +#line 4416 "seclang-parser.cc" // lalr1.cc:870 break; case 321: -#line 2564 "seclang-parser.yy" // lalr1.cc:870 +#line 2566 "seclang-parser.yy" // lalr1.cc:870 { std::string name(yystack_[0].value.as< std::string > ()); char z = name.at(0); std::unique_ptr c(new RemoteUser(name)); yylhs.value.as< std::unique_ptr > () = std::move(c); } -#line 4425 "seclang-parser.cc" // lalr1.cc:870 +#line 4427 "seclang-parser.cc" // lalr1.cc:870 break; case 322: -#line 2571 "seclang-parser.yy" // lalr1.cc:870 +#line 2573 "seclang-parser.yy" // lalr1.cc:870 { std::string name(yystack_[0].value.as< std::string > ()); char z = name.at(0); std::unique_ptr c(new Time(name)); yylhs.value.as< std::unique_ptr > () = std::move(c); } -#line 4436 "seclang-parser.cc" // lalr1.cc:870 +#line 4438 "seclang-parser.cc" // lalr1.cc:870 break; case 323: -#line 2578 "seclang-parser.yy" // lalr1.cc:870 +#line 2580 "seclang-parser.yy" // lalr1.cc:870 { std::string name(yystack_[0].value.as< std::string > ()); char z = name.at(0); std::unique_ptr c(new TimeDay(name)); yylhs.value.as< std::unique_ptr > () = std::move(c); } -#line 4447 "seclang-parser.cc" // lalr1.cc:870 +#line 4449 "seclang-parser.cc" // lalr1.cc:870 break; case 324: -#line 2585 "seclang-parser.yy" // lalr1.cc:870 +#line 2587 "seclang-parser.yy" // lalr1.cc:870 { std::string name(yystack_[0].value.as< std::string > ()); char z = name.at(0); std::unique_ptr c(new TimeEpoch(name)); yylhs.value.as< std::unique_ptr > () = std::move(c); } -#line 4458 "seclang-parser.cc" // lalr1.cc:870 +#line 4460 "seclang-parser.cc" // lalr1.cc:870 break; case 325: -#line 2592 "seclang-parser.yy" // lalr1.cc:870 +#line 2594 "seclang-parser.yy" // lalr1.cc:870 { std::string name(yystack_[0].value.as< std::string > ()); char z = name.at(0); std::unique_ptr c(new TimeHour(name)); yylhs.value.as< std::unique_ptr > () = std::move(c); } -#line 4469 "seclang-parser.cc" // lalr1.cc:870 +#line 4471 "seclang-parser.cc" // lalr1.cc:870 break; case 326: -#line 2599 "seclang-parser.yy" // lalr1.cc:870 +#line 2601 "seclang-parser.yy" // lalr1.cc:870 { std::string name(yystack_[0].value.as< std::string > ()); char z = name.at(0); std::unique_ptr c(new TimeMin(name)); yylhs.value.as< std::unique_ptr > () = std::move(c); } -#line 4480 "seclang-parser.cc" // lalr1.cc:870 +#line 4482 "seclang-parser.cc" // lalr1.cc:870 break; case 327: -#line 2606 "seclang-parser.yy" // lalr1.cc:870 +#line 2608 "seclang-parser.yy" // lalr1.cc:870 { std::string name(yystack_[0].value.as< std::string > ()); char z = name.at(0); std::unique_ptr c(new TimeMon(name)); yylhs.value.as< std::unique_ptr > () = std::move(c); } -#line 4491 "seclang-parser.cc" // lalr1.cc:870 +#line 4493 "seclang-parser.cc" // lalr1.cc:870 break; case 328: -#line 2613 "seclang-parser.yy" // lalr1.cc:870 +#line 2615 "seclang-parser.yy" // lalr1.cc:870 { std::string name(yystack_[0].value.as< std::string > ()); char z = name.at(0); std::unique_ptr c(new TimeSec(name)); yylhs.value.as< std::unique_ptr > () = std::move(c); } -#line 4502 "seclang-parser.cc" // lalr1.cc:870 +#line 4504 "seclang-parser.cc" // lalr1.cc:870 break; case 329: -#line 2620 "seclang-parser.yy" // lalr1.cc:870 +#line 2622 "seclang-parser.yy" // lalr1.cc:870 { std::string name(yystack_[0].value.as< std::string > ()); char z = name.at(0); std::unique_ptr c(new TimeWDay(name)); yylhs.value.as< std::unique_ptr > () = std::move(c); } -#line 4513 "seclang-parser.cc" // lalr1.cc:870 +#line 4515 "seclang-parser.cc" // lalr1.cc:870 break; case 330: -#line 2627 "seclang-parser.yy" // lalr1.cc:870 +#line 2629 "seclang-parser.yy" // lalr1.cc:870 { std::string name(yystack_[0].value.as< std::string > ()); char z = name.at(0); std::unique_ptr c(new TimeYear(name)); yylhs.value.as< std::unique_ptr > () = std::move(c); } -#line 4524 "seclang-parser.cc" // lalr1.cc:870 +#line 4526 "seclang-parser.cc" // lalr1.cc:870 break; case 331: -#line 2637 "seclang-parser.yy" // lalr1.cc:870 +#line 2639 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::Accuracy(yystack_[0].value.as< std::string > ())); } -#line 4532 "seclang-parser.cc" // lalr1.cc:870 +#line 4534 "seclang-parser.cc" // lalr1.cc:870 break; case 332: -#line 2641 "seclang-parser.yy" // lalr1.cc:870 +#line 2643 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::disruptive::Allow(yystack_[0].value.as< std::string > ())); } -#line 4540 "seclang-parser.cc" // lalr1.cc:870 +#line 4542 "seclang-parser.cc" // lalr1.cc:870 break; case 333: -#line 2645 "seclang-parser.yy" // lalr1.cc:870 +#line 2647 "seclang-parser.yy" // lalr1.cc:870 { ACTION_NOT_SUPPORTED("Append", yystack_[1].location); } -#line 4548 "seclang-parser.cc" // lalr1.cc:870 +#line 4550 "seclang-parser.cc" // lalr1.cc:870 break; case 334: -#line 2649 "seclang-parser.yy" // lalr1.cc:870 +#line 2651 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::AuditLog(yystack_[0].value.as< std::string > ())); } -#line 4556 "seclang-parser.cc" // lalr1.cc:870 +#line 4558 "seclang-parser.cc" // lalr1.cc:870 break; case 335: -#line 2653 "seclang-parser.yy" // lalr1.cc:870 +#line 2655 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::Block(yystack_[0].value.as< std::string > ())); } -#line 4564 "seclang-parser.cc" // lalr1.cc:870 +#line 4566 "seclang-parser.cc" // lalr1.cc:870 break; case 336: -#line 2657 "seclang-parser.yy" // lalr1.cc:870 +#line 2659 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::Capture(yystack_[0].value.as< std::string > ())); } -#line 4572 "seclang-parser.cc" // lalr1.cc:870 +#line 4574 "seclang-parser.cc" // lalr1.cc:870 break; case 337: -#line 2661 "seclang-parser.yy" // lalr1.cc:870 +#line 2663 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::Chain(yystack_[0].value.as< std::string > ())); } -#line 4580 "seclang-parser.cc" // lalr1.cc:870 +#line 4582 "seclang-parser.cc" // lalr1.cc:870 break; case 338: -#line 2665 "seclang-parser.yy" // lalr1.cc:870 +#line 2667 "seclang-parser.yy" // lalr1.cc:870 { //ACTION_NOT_SUPPORTED("CtlAuditEngine", @0); ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::Action(yystack_[1].value.as< std::string > ())); } -#line 4589 "seclang-parser.cc" // lalr1.cc:870 +#line 4591 "seclang-parser.cc" // lalr1.cc:870 break; case 339: -#line 2670 "seclang-parser.yy" // lalr1.cc:870 +#line 2672 "seclang-parser.yy" // lalr1.cc:870 { //ACTION_NOT_SUPPORTED("CtlAuditEngine", @0); ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::Action(yystack_[1].value.as< std::string > ())); } -#line 4598 "seclang-parser.cc" // lalr1.cc:870 +#line 4600 "seclang-parser.cc" // lalr1.cc:870 break; case 340: -#line 2675 "seclang-parser.yy" // lalr1.cc:870 +#line 2677 "seclang-parser.yy" // lalr1.cc:870 { //ACTION_NOT_SUPPORTED("CtlAuditEngine", @0); ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::Action(yystack_[1].value.as< std::string > ())); } -#line 4607 "seclang-parser.cc" // lalr1.cc:870 +#line 4609 "seclang-parser.cc" // lalr1.cc:870 break; case 341: -#line 2680 "seclang-parser.yy" // lalr1.cc:870 +#line 2682 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::ctl::AuditLogParts(yystack_[0].value.as< std::string > ())); } -#line 4615 "seclang-parser.cc" // lalr1.cc:870 +#line 4617 "seclang-parser.cc" // lalr1.cc:870 break; case 342: -#line 2684 "seclang-parser.yy" // lalr1.cc:870 +#line 2686 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::ctl::RequestBodyProcessorJSON(yystack_[0].value.as< std::string > ())); } -#line 4623 "seclang-parser.cc" // lalr1.cc:870 +#line 4625 "seclang-parser.cc" // lalr1.cc:870 break; case 343: -#line 2688 "seclang-parser.yy" // lalr1.cc:870 +#line 2690 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::ctl::RequestBodyProcessorXML(yystack_[0].value.as< std::string > ())); } -#line 4631 "seclang-parser.cc" // lalr1.cc:870 +#line 4633 "seclang-parser.cc" // lalr1.cc:870 break; case 344: -#line 2692 "seclang-parser.yy" // lalr1.cc:870 +#line 2694 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::ctl::RequestBodyProcessorURLENCODED(yystack_[0].value.as< std::string > ())); } -#line 4639 "seclang-parser.cc" // lalr1.cc:870 +#line 4641 "seclang-parser.cc" // lalr1.cc:870 break; case 345: -#line 2696 "seclang-parser.yy" // lalr1.cc:870 +#line 2698 "seclang-parser.yy" // lalr1.cc:870 { //ACTION_NOT_SUPPORTED("CtlForceReequestBody", @0); ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::Action(yystack_[1].value.as< std::string > ())); } -#line 4648 "seclang-parser.cc" // lalr1.cc:870 +#line 4650 "seclang-parser.cc" // lalr1.cc:870 break; case 346: -#line 2701 "seclang-parser.yy" // lalr1.cc:870 +#line 2703 "seclang-parser.yy" // lalr1.cc:870 { //ACTION_NOT_SUPPORTED("CtlForceReequestBody", @0); ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::Action(yystack_[1].value.as< std::string > ())); } -#line 4657 "seclang-parser.cc" // lalr1.cc:870 +#line 4659 "seclang-parser.cc" // lalr1.cc:870 break; case 347: -#line 2706 "seclang-parser.yy" // lalr1.cc:870 +#line 2708 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::ctl::RequestBodyAccess(yystack_[1].value.as< std::string > () + "true")); } -#line 4665 "seclang-parser.cc" // lalr1.cc:870 +#line 4667 "seclang-parser.cc" // lalr1.cc:870 break; case 348: -#line 2710 "seclang-parser.yy" // lalr1.cc:870 +#line 2712 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::ctl::RequestBodyAccess(yystack_[1].value.as< std::string > () + "false")); } -#line 4673 "seclang-parser.cc" // lalr1.cc:870 +#line 4675 "seclang-parser.cc" // lalr1.cc:870 break; case 349: -#line 2714 "seclang-parser.yy" // lalr1.cc:870 +#line 2716 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::ctl::RuleEngine("ctl:RuleEngine=on")); } -#line 4681 "seclang-parser.cc" // lalr1.cc:870 +#line 4683 "seclang-parser.cc" // lalr1.cc:870 break; case 350: -#line 2718 "seclang-parser.yy" // lalr1.cc:870 +#line 2720 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::ctl::RuleEngine("ctl:RuleEngine=off")); } -#line 4689 "seclang-parser.cc" // lalr1.cc:870 +#line 4691 "seclang-parser.cc" // lalr1.cc:870 break; case 351: -#line 2722 "seclang-parser.yy" // lalr1.cc:870 +#line 2724 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::ctl::RuleEngine("ctl:RuleEngine=detectiononly")); } -#line 4697 "seclang-parser.cc" // lalr1.cc:870 +#line 4699 "seclang-parser.cc" // lalr1.cc:870 break; case 352: -#line 2726 "seclang-parser.yy" // lalr1.cc:870 +#line 2728 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::ctl::RuleRemoveById(yystack_[0].value.as< std::string > ())); } -#line 4705 "seclang-parser.cc" // lalr1.cc:870 +#line 4707 "seclang-parser.cc" // lalr1.cc:870 break; case 353: -#line 2730 "seclang-parser.yy" // lalr1.cc:870 +#line 2732 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::ctl::RuleRemoveByTag(yystack_[0].value.as< std::string > ())); } -#line 4713 "seclang-parser.cc" // lalr1.cc:870 +#line 4715 "seclang-parser.cc" // lalr1.cc:870 break; case 354: -#line 2734 "seclang-parser.yy" // lalr1.cc:870 +#line 2736 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::ctl::RuleRemoveTargetById(yystack_[0].value.as< std::string > ())); } -#line 4721 "seclang-parser.cc" // lalr1.cc:870 +#line 4723 "seclang-parser.cc" // lalr1.cc:870 break; case 355: -#line 2738 "seclang-parser.yy" // lalr1.cc:870 +#line 2740 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::ctl::RuleRemoveTargetByTag(yystack_[0].value.as< std::string > ())); } -#line 4729 "seclang-parser.cc" // lalr1.cc:870 +#line 4731 "seclang-parser.cc" // lalr1.cc:870 break; case 356: -#line 2742 "seclang-parser.yy" // lalr1.cc:870 +#line 2744 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::disruptive::Deny(yystack_[0].value.as< std::string > ())); } -#line 4737 "seclang-parser.cc" // lalr1.cc:870 +#line 4739 "seclang-parser.cc" // lalr1.cc:870 break; case 357: -#line 2746 "seclang-parser.yy" // lalr1.cc:870 +#line 2748 "seclang-parser.yy" // lalr1.cc:870 { ACTION_NOT_SUPPORTED("DeprecateVar", yystack_[1].location); } -#line 4745 "seclang-parser.cc" // lalr1.cc:870 +#line 4747 "seclang-parser.cc" // lalr1.cc:870 break; case 358: -#line 2750 "seclang-parser.yy" // lalr1.cc:870 +#line 2752 "seclang-parser.yy" // lalr1.cc:870 { //ACTION_NOT_SUPPORTED("Drop", @0); ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::Action(yystack_[0].value.as< std::string > ())); } -#line 4754 "seclang-parser.cc" // lalr1.cc:870 +#line 4756 "seclang-parser.cc" // lalr1.cc:870 break; case 359: -#line 2755 "seclang-parser.yy" // lalr1.cc:870 +#line 2757 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::Exec(yystack_[0].value.as< std::string > ())); } -#line 4762 "seclang-parser.cc" // lalr1.cc:870 +#line 4764 "seclang-parser.cc" // lalr1.cc:870 break; case 360: -#line 2759 "seclang-parser.yy" // lalr1.cc:870 +#line 2761 "seclang-parser.yy" // lalr1.cc:870 { //ACTION_NOT_SUPPORTED("ExpireVar", @0); ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::Action(yystack_[0].value.as< std::string > ())); } -#line 4771 "seclang-parser.cc" // lalr1.cc:870 +#line 4773 "seclang-parser.cc" // lalr1.cc:870 break; case 361: -#line 2764 "seclang-parser.yy" // lalr1.cc:870 +#line 2766 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::RuleId(yystack_[0].value.as< std::string > ())); } -#line 4779 "seclang-parser.cc" // lalr1.cc:870 +#line 4781 "seclang-parser.cc" // lalr1.cc:870 break; case 362: -#line 2768 "seclang-parser.yy" // lalr1.cc:870 +#line 2770 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::InitCol(yystack_[1].value.as< std::string > (), std::move(yystack_[0].value.as< std::unique_ptr > ()))); } -#line 4787 "seclang-parser.cc" // lalr1.cc:870 +#line 4789 "seclang-parser.cc" // lalr1.cc:870 break; case 363: -#line 2772 "seclang-parser.yy" // lalr1.cc:870 +#line 2774 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::LogData(std::move(yystack_[0].value.as< std::unique_ptr > ()))); } -#line 4795 "seclang-parser.cc" // lalr1.cc:870 +#line 4797 "seclang-parser.cc" // lalr1.cc:870 break; case 364: -#line 2776 "seclang-parser.yy" // lalr1.cc:870 +#line 2778 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::Log(yystack_[0].value.as< std::string > ())); } -#line 4803 "seclang-parser.cc" // lalr1.cc:870 +#line 4805 "seclang-parser.cc" // lalr1.cc:870 break; case 365: -#line 2780 "seclang-parser.yy" // lalr1.cc:870 +#line 2782 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::Maturity(yystack_[0].value.as< std::string > ())); } -#line 4811 "seclang-parser.cc" // lalr1.cc:870 +#line 4813 "seclang-parser.cc" // lalr1.cc:870 break; case 366: -#line 2784 "seclang-parser.yy" // lalr1.cc:870 +#line 2786 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::Msg(std::move(yystack_[0].value.as< std::unique_ptr > ()))); } -#line 4819 "seclang-parser.cc" // lalr1.cc:870 +#line 4821 "seclang-parser.cc" // lalr1.cc:870 break; case 367: -#line 2788 "seclang-parser.yy" // lalr1.cc:870 +#line 2790 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::MultiMatch(yystack_[0].value.as< std::string > ())); } -#line 4827 "seclang-parser.cc" // lalr1.cc:870 +#line 4829 "seclang-parser.cc" // lalr1.cc:870 break; case 368: -#line 2792 "seclang-parser.yy" // lalr1.cc:870 +#line 2794 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::NoAuditLog(yystack_[0].value.as< std::string > ())); } -#line 4835 "seclang-parser.cc" // lalr1.cc:870 +#line 4837 "seclang-parser.cc" // lalr1.cc:870 break; case 369: -#line 2796 "seclang-parser.yy" // lalr1.cc:870 +#line 2798 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::NoLog(yystack_[0].value.as< std::string > ())); } -#line 4843 "seclang-parser.cc" // lalr1.cc:870 +#line 4845 "seclang-parser.cc" // lalr1.cc:870 break; case 370: -#line 2800 "seclang-parser.yy" // lalr1.cc:870 +#line 2802 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::disruptive::Pass(yystack_[0].value.as< std::string > ())); } -#line 4851 "seclang-parser.cc" // lalr1.cc:870 +#line 4853 "seclang-parser.cc" // lalr1.cc:870 break; case 371: -#line 2804 "seclang-parser.yy" // lalr1.cc:870 +#line 2806 "seclang-parser.yy" // lalr1.cc:870 { ACTION_NOT_SUPPORTED("Pause", yystack_[1].location); } -#line 4859 "seclang-parser.cc" // lalr1.cc:870 +#line 4861 "seclang-parser.cc" // lalr1.cc:870 break; case 372: -#line 2808 "seclang-parser.yy" // lalr1.cc:870 +#line 2810 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::Phase(yystack_[0].value.as< std::string > ())); } -#line 4867 "seclang-parser.cc" // lalr1.cc:870 +#line 4869 "seclang-parser.cc" // lalr1.cc:870 break; case 373: -#line 2812 "seclang-parser.yy" // lalr1.cc:870 +#line 2814 "seclang-parser.yy" // lalr1.cc:870 { ACTION_NOT_SUPPORTED("Prepend", yystack_[1].location); } -#line 4875 "seclang-parser.cc" // lalr1.cc:870 +#line 4877 "seclang-parser.cc" // lalr1.cc:870 break; case 374: -#line 2816 "seclang-parser.yy" // lalr1.cc:870 +#line 2818 "seclang-parser.yy" // lalr1.cc:870 { ACTION_NOT_SUPPORTED("Proxy", yystack_[1].location); } -#line 4883 "seclang-parser.cc" // lalr1.cc:870 +#line 4885 "seclang-parser.cc" // lalr1.cc:870 break; case 375: -#line 2820 "seclang-parser.yy" // lalr1.cc:870 +#line 2822 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::disruptive::Redirect(std::move(yystack_[0].value.as< std::unique_ptr > ()))); } -#line 4891 "seclang-parser.cc" // lalr1.cc:870 +#line 4893 "seclang-parser.cc" // lalr1.cc:870 break; case 376: -#line 2824 "seclang-parser.yy" // lalr1.cc:870 +#line 2826 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::Rev(yystack_[0].value.as< std::string > ())); } -#line 4899 "seclang-parser.cc" // lalr1.cc:870 +#line 4901 "seclang-parser.cc" // lalr1.cc:870 break; case 377: -#line 2828 "seclang-parser.yy" // lalr1.cc:870 +#line 2830 "seclang-parser.yy" // lalr1.cc:870 { ACTION_NOT_SUPPORTED("SanitiseArg", yystack_[1].location); } -#line 4907 "seclang-parser.cc" // lalr1.cc:870 +#line 4909 "seclang-parser.cc" // lalr1.cc:870 break; case 378: -#line 2832 "seclang-parser.yy" // lalr1.cc:870 +#line 2834 "seclang-parser.yy" // lalr1.cc:870 { ACTION_NOT_SUPPORTED("SanitiseMatched", yystack_[1].location); } -#line 4915 "seclang-parser.cc" // lalr1.cc:870 +#line 4917 "seclang-parser.cc" // lalr1.cc:870 break; case 379: -#line 2836 "seclang-parser.yy" // lalr1.cc:870 +#line 2838 "seclang-parser.yy" // lalr1.cc:870 { ACTION_NOT_SUPPORTED("SanitiseMatchedBytes", yystack_[1].location); } -#line 4923 "seclang-parser.cc" // lalr1.cc:870 +#line 4925 "seclang-parser.cc" // lalr1.cc:870 break; case 380: -#line 2840 "seclang-parser.yy" // lalr1.cc:870 +#line 2842 "seclang-parser.yy" // lalr1.cc:870 { ACTION_NOT_SUPPORTED("SanitiseRequestHeader", yystack_[1].location); } -#line 4931 "seclang-parser.cc" // lalr1.cc:870 +#line 4933 "seclang-parser.cc" // lalr1.cc:870 break; case 381: -#line 2844 "seclang-parser.yy" // lalr1.cc:870 +#line 2846 "seclang-parser.yy" // lalr1.cc:870 { ACTION_NOT_SUPPORTED("SanitiseResponseHeader", yystack_[1].location); } -#line 4939 "seclang-parser.cc" // lalr1.cc:870 +#line 4941 "seclang-parser.cc" // lalr1.cc:870 break; case 382: -#line 2848 "seclang-parser.yy" // lalr1.cc:870 +#line 2850 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::SetENV(std::move(yystack_[0].value.as< std::unique_ptr > ()))); } -#line 4947 "seclang-parser.cc" // lalr1.cc:870 +#line 4949 "seclang-parser.cc" // lalr1.cc:870 break; case 383: -#line 2852 "seclang-parser.yy" // lalr1.cc:870 +#line 2854 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::SetRSC(std::move(yystack_[0].value.as< std::unique_ptr > ()))); } -#line 4955 "seclang-parser.cc" // lalr1.cc:870 +#line 4957 "seclang-parser.cc" // lalr1.cc:870 break; case 384: -#line 2856 "seclang-parser.yy" // lalr1.cc:870 +#line 2858 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::SetSID(std::move(yystack_[0].value.as< std::unique_ptr > ()))); } -#line 4963 "seclang-parser.cc" // lalr1.cc:870 +#line 4965 "seclang-parser.cc" // lalr1.cc:870 break; case 385: -#line 2860 "seclang-parser.yy" // lalr1.cc:870 +#line 2862 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::SetUID(std::move(yystack_[0].value.as< std::unique_ptr > ()))); } -#line 4971 "seclang-parser.cc" // lalr1.cc:870 +#line 4973 "seclang-parser.cc" // lalr1.cc:870 break; case 386: -#line 2864 "seclang-parser.yy" // lalr1.cc:870 +#line 2866 "seclang-parser.yy" // lalr1.cc:870 { yylhs.value.as< std::unique_ptr > () = std::move(yystack_[0].value.as< std::unique_ptr > ()); } -#line 4979 "seclang-parser.cc" // lalr1.cc:870 +#line 4981 "seclang-parser.cc" // lalr1.cc:870 break; case 387: -#line 2868 "seclang-parser.yy" // lalr1.cc:870 +#line 2870 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::Severity(yystack_[0].value.as< std::string > ())); } -#line 4987 "seclang-parser.cc" // lalr1.cc:870 +#line 4989 "seclang-parser.cc" // lalr1.cc:870 break; case 388: -#line 2872 "seclang-parser.yy" // lalr1.cc:870 +#line 2874 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::Skip(yystack_[0].value.as< std::string > ())); } -#line 4995 "seclang-parser.cc" // lalr1.cc:870 +#line 4997 "seclang-parser.cc" // lalr1.cc:870 break; case 389: -#line 2876 "seclang-parser.yy" // lalr1.cc:870 +#line 2878 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::SkipAfter(yystack_[0].value.as< std::string > ())); } -#line 5003 "seclang-parser.cc" // lalr1.cc:870 +#line 5005 "seclang-parser.cc" // lalr1.cc:870 break; case 390: -#line 2880 "seclang-parser.yy" // lalr1.cc:870 +#line 2882 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::data::Status(yystack_[0].value.as< std::string > ())); } -#line 5011 "seclang-parser.cc" // lalr1.cc:870 +#line 5013 "seclang-parser.cc" // lalr1.cc:870 break; case 391: -#line 2884 "seclang-parser.yy" // lalr1.cc:870 +#line 2886 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::Tag(std::move(yystack_[0].value.as< std::unique_ptr > ()))); } -#line 5019 "seclang-parser.cc" // lalr1.cc:870 +#line 5021 "seclang-parser.cc" // lalr1.cc:870 break; case 392: -#line 2888 "seclang-parser.yy" // lalr1.cc:870 +#line 2890 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::Ver(yystack_[0].value.as< std::string > ())); } -#line 5027 "seclang-parser.cc" // lalr1.cc:870 +#line 5029 "seclang-parser.cc" // lalr1.cc:870 break; case 393: -#line 2892 "seclang-parser.yy" // lalr1.cc:870 +#line 2894 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::XmlNS(yystack_[0].value.as< std::string > ())); } -#line 5035 "seclang-parser.cc" // lalr1.cc:870 +#line 5037 "seclang-parser.cc" // lalr1.cc:870 break; case 394: -#line 2896 "seclang-parser.yy" // lalr1.cc:870 +#line 2898 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::ParityZero7bit(yystack_[0].value.as< std::string > ())); } -#line 5043 "seclang-parser.cc" // lalr1.cc:870 +#line 5045 "seclang-parser.cc" // lalr1.cc:870 break; case 395: -#line 2900 "seclang-parser.yy" // lalr1.cc:870 +#line 2902 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::ParityOdd7bit(yystack_[0].value.as< std::string > ())); } -#line 5051 "seclang-parser.cc" // lalr1.cc:870 +#line 5053 "seclang-parser.cc" // lalr1.cc:870 break; case 396: -#line 2904 "seclang-parser.yy" // lalr1.cc:870 +#line 2906 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::ParityEven7bit(yystack_[0].value.as< std::string > ())); } -#line 5059 "seclang-parser.cc" // lalr1.cc:870 +#line 5061 "seclang-parser.cc" // lalr1.cc:870 break; case 397: -#line 2908 "seclang-parser.yy" // lalr1.cc:870 +#line 2910 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::SqlHexDecode(yystack_[0].value.as< std::string > ())); } -#line 5067 "seclang-parser.cc" // lalr1.cc:870 +#line 5069 "seclang-parser.cc" // lalr1.cc:870 break; case 398: -#line 2912 "seclang-parser.yy" // lalr1.cc:870 +#line 2914 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::Base64Encode(yystack_[0].value.as< std::string > ())); } -#line 5075 "seclang-parser.cc" // lalr1.cc:870 +#line 5077 "seclang-parser.cc" // lalr1.cc:870 break; case 399: -#line 2916 "seclang-parser.yy" // lalr1.cc:870 +#line 2918 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::Base64Decode(yystack_[0].value.as< std::string > ())); } -#line 5083 "seclang-parser.cc" // lalr1.cc:870 +#line 5085 "seclang-parser.cc" // lalr1.cc:870 break; case 400: -#line 2920 "seclang-parser.yy" // lalr1.cc:870 +#line 2922 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::Base64DecodeExt(yystack_[0].value.as< std::string > ())); } -#line 5091 "seclang-parser.cc" // lalr1.cc:870 +#line 5093 "seclang-parser.cc" // lalr1.cc:870 break; case 401: -#line 2924 "seclang-parser.yy" // lalr1.cc:870 +#line 2926 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::CmdLine(yystack_[0].value.as< std::string > ())); } -#line 5099 "seclang-parser.cc" // lalr1.cc:870 +#line 5101 "seclang-parser.cc" // lalr1.cc:870 break; case 402: -#line 2928 "seclang-parser.yy" // lalr1.cc:870 +#line 2930 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::Sha1(yystack_[0].value.as< std::string > ())); } -#line 5107 "seclang-parser.cc" // lalr1.cc:870 +#line 5109 "seclang-parser.cc" // lalr1.cc:870 break; case 403: -#line 2932 "seclang-parser.yy" // lalr1.cc:870 +#line 2934 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::Md5(yystack_[0].value.as< std::string > ())); } -#line 5115 "seclang-parser.cc" // lalr1.cc:870 +#line 5117 "seclang-parser.cc" // lalr1.cc:870 break; case 404: -#line 2936 "seclang-parser.yy" // lalr1.cc:870 +#line 2938 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::EscapeSeqDecode(yystack_[0].value.as< std::string > ())); } -#line 5123 "seclang-parser.cc" // lalr1.cc:870 +#line 5125 "seclang-parser.cc" // lalr1.cc:870 break; case 405: -#line 2940 "seclang-parser.yy" // lalr1.cc:870 +#line 2942 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::HexEncode(yystack_[0].value.as< std::string > ())); } -#line 5131 "seclang-parser.cc" // lalr1.cc:870 +#line 5133 "seclang-parser.cc" // lalr1.cc:870 break; case 406: -#line 2944 "seclang-parser.yy" // lalr1.cc:870 +#line 2946 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::HexDecode(yystack_[0].value.as< std::string > ())); } -#line 5139 "seclang-parser.cc" // lalr1.cc:870 +#line 5141 "seclang-parser.cc" // lalr1.cc:870 break; case 407: -#line 2948 "seclang-parser.yy" // lalr1.cc:870 +#line 2950 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::LowerCase(yystack_[0].value.as< std::string > ())); } -#line 5147 "seclang-parser.cc" // lalr1.cc:870 +#line 5149 "seclang-parser.cc" // lalr1.cc:870 break; case 408: -#line 2952 "seclang-parser.yy" // lalr1.cc:870 +#line 2954 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::UpperCase(yystack_[0].value.as< std::string > ())); } -#line 5155 "seclang-parser.cc" // lalr1.cc:870 +#line 5157 "seclang-parser.cc" // lalr1.cc:870 break; case 409: -#line 2956 "seclang-parser.yy" // lalr1.cc:870 +#line 2958 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::UrlDecodeUni(yystack_[0].value.as< std::string > ())); } -#line 5163 "seclang-parser.cc" // lalr1.cc:870 +#line 5165 "seclang-parser.cc" // lalr1.cc:870 break; case 410: -#line 2960 "seclang-parser.yy" // lalr1.cc:870 +#line 2962 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::UrlDecode(yystack_[0].value.as< std::string > ())); } -#line 5171 "seclang-parser.cc" // lalr1.cc:870 +#line 5173 "seclang-parser.cc" // lalr1.cc:870 break; case 411: -#line 2964 "seclang-parser.yy" // lalr1.cc:870 +#line 2966 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::UrlEncode(yystack_[0].value.as< std::string > ())); } -#line 5179 "seclang-parser.cc" // lalr1.cc:870 +#line 5181 "seclang-parser.cc" // lalr1.cc:870 break; case 412: -#line 2968 "seclang-parser.yy" // lalr1.cc:870 +#line 2970 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::None(yystack_[0].value.as< std::string > ())); } -#line 5187 "seclang-parser.cc" // lalr1.cc:870 +#line 5189 "seclang-parser.cc" // lalr1.cc:870 break; case 413: -#line 2972 "seclang-parser.yy" // lalr1.cc:870 +#line 2974 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::CompressWhitespace(yystack_[0].value.as< std::string > ())); } -#line 5195 "seclang-parser.cc" // lalr1.cc:870 +#line 5197 "seclang-parser.cc" // lalr1.cc:870 break; case 414: -#line 2976 "seclang-parser.yy" // lalr1.cc:870 +#line 2978 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::RemoveWhitespace(yystack_[0].value.as< std::string > ())); } -#line 5203 "seclang-parser.cc" // lalr1.cc:870 +#line 5205 "seclang-parser.cc" // lalr1.cc:870 break; case 415: -#line 2980 "seclang-parser.yy" // lalr1.cc:870 +#line 2982 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::ReplaceNulls(yystack_[0].value.as< std::string > ())); } -#line 5211 "seclang-parser.cc" // lalr1.cc:870 +#line 5213 "seclang-parser.cc" // lalr1.cc:870 break; case 416: -#line 2984 "seclang-parser.yy" // lalr1.cc:870 +#line 2986 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::RemoveNulls(yystack_[0].value.as< std::string > ())); } -#line 5219 "seclang-parser.cc" // lalr1.cc:870 +#line 5221 "seclang-parser.cc" // lalr1.cc:870 break; case 417: -#line 2988 "seclang-parser.yy" // lalr1.cc:870 +#line 2990 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::HtmlEntityDecode(yystack_[0].value.as< std::string > ())); } -#line 5227 "seclang-parser.cc" // lalr1.cc:870 +#line 5229 "seclang-parser.cc" // lalr1.cc:870 break; case 418: -#line 2992 "seclang-parser.yy" // lalr1.cc:870 +#line 2994 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::JsDecode(yystack_[0].value.as< std::string > ())); } -#line 5235 "seclang-parser.cc" // lalr1.cc:870 +#line 5237 "seclang-parser.cc" // lalr1.cc:870 break; case 419: -#line 2996 "seclang-parser.yy" // lalr1.cc:870 +#line 2998 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::CssDecode(yystack_[0].value.as< std::string > ())); } -#line 5243 "seclang-parser.cc" // lalr1.cc:870 +#line 5245 "seclang-parser.cc" // lalr1.cc:870 break; case 420: -#line 3000 "seclang-parser.yy" // lalr1.cc:870 +#line 3002 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::Trim(yystack_[0].value.as< std::string > ())); } -#line 5251 "seclang-parser.cc" // lalr1.cc:870 +#line 5253 "seclang-parser.cc" // lalr1.cc:870 break; case 421: -#line 3004 "seclang-parser.yy" // lalr1.cc:870 +#line 3006 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::TrimLeft(yystack_[0].value.as< std::string > ())); } -#line 5259 "seclang-parser.cc" // lalr1.cc:870 +#line 5261 "seclang-parser.cc" // lalr1.cc:870 break; case 422: -#line 3008 "seclang-parser.yy" // lalr1.cc:870 +#line 3010 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::TrimRight(yystack_[0].value.as< std::string > ())); } -#line 5267 "seclang-parser.cc" // lalr1.cc:870 +#line 5269 "seclang-parser.cc" // lalr1.cc:870 break; case 423: -#line 3012 "seclang-parser.yy" // lalr1.cc:870 +#line 3014 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::NormalisePathWin(yystack_[0].value.as< std::string > ())); } -#line 5275 "seclang-parser.cc" // lalr1.cc:870 +#line 5277 "seclang-parser.cc" // lalr1.cc:870 break; case 424: -#line 3016 "seclang-parser.yy" // lalr1.cc:870 +#line 3018 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::NormalisePath(yystack_[0].value.as< std::string > ())); } -#line 5283 "seclang-parser.cc" // lalr1.cc:870 +#line 5285 "seclang-parser.cc" // lalr1.cc:870 break; case 425: -#line 3020 "seclang-parser.yy" // lalr1.cc:870 +#line 3022 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::Length(yystack_[0].value.as< std::string > ())); } -#line 5291 "seclang-parser.cc" // lalr1.cc:870 +#line 5293 "seclang-parser.cc" // lalr1.cc:870 break; case 426: -#line 3024 "seclang-parser.yy" // lalr1.cc:870 +#line 3026 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::Utf8ToUnicode(yystack_[0].value.as< std::string > ())); } -#line 5299 "seclang-parser.cc" // lalr1.cc:870 +#line 5301 "seclang-parser.cc" // lalr1.cc:870 break; case 427: -#line 3028 "seclang-parser.yy" // lalr1.cc:870 +#line 3030 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::RemoveCommentsChar(yystack_[0].value.as< std::string > ())); } -#line 5307 "seclang-parser.cc" // lalr1.cc:870 +#line 5309 "seclang-parser.cc" // lalr1.cc:870 break; case 428: -#line 3032 "seclang-parser.yy" // lalr1.cc:870 +#line 3034 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::RemoveComments(yystack_[0].value.as< std::string > ())); } -#line 5315 "seclang-parser.cc" // lalr1.cc:870 +#line 5317 "seclang-parser.cc" // lalr1.cc:870 break; case 429: -#line 3036 "seclang-parser.yy" // lalr1.cc:870 +#line 3038 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::transformations::ReplaceComments(yystack_[0].value.as< std::string > ())); } -#line 5323 "seclang-parser.cc" // lalr1.cc:870 +#line 5325 "seclang-parser.cc" // lalr1.cc:870 break; case 430: -#line 3043 "seclang-parser.yy" // lalr1.cc:870 +#line 3045 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::SetVar(actions::SetVarOperation::unsetOperation, std::move(yystack_[0].value.as< std::unique_ptr > ()))); } -#line 5331 "seclang-parser.cc" // lalr1.cc:870 +#line 5333 "seclang-parser.cc" // lalr1.cc:870 break; case 431: -#line 3047 "seclang-parser.yy" // lalr1.cc:870 +#line 3049 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::SetVar(actions::SetVarOperation::setToOneOperation, std::move(yystack_[0].value.as< std::unique_ptr > ()))); } -#line 5339 "seclang-parser.cc" // lalr1.cc:870 +#line 5341 "seclang-parser.cc" // lalr1.cc:870 break; case 432: -#line 3051 "seclang-parser.yy" // lalr1.cc:870 +#line 3053 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::SetVar(actions::SetVarOperation::setOperation, std::move(yystack_[2].value.as< std::unique_ptr > ()), std::move(yystack_[0].value.as< std::unique_ptr > ()))); } -#line 5347 "seclang-parser.cc" // lalr1.cc:870 +#line 5349 "seclang-parser.cc" // lalr1.cc:870 break; case 433: -#line 3055 "seclang-parser.yy" // lalr1.cc:870 +#line 3057 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::SetVar(actions::SetVarOperation::sumAndSetOperation, std::move(yystack_[2].value.as< std::unique_ptr > ()), std::move(yystack_[0].value.as< std::unique_ptr > ()))); } -#line 5355 "seclang-parser.cc" // lalr1.cc:870 +#line 5357 "seclang-parser.cc" // lalr1.cc:870 break; case 434: -#line 3059 "seclang-parser.yy" // lalr1.cc:870 +#line 3061 "seclang-parser.yy" // lalr1.cc:870 { ACTION_CONTAINER(yylhs.value.as< std::unique_ptr > (), new actions::SetVar(actions::SetVarOperation::substractAndSetOperation, std::move(yystack_[2].value.as< std::unique_ptr > ()), std::move(yystack_[0].value.as< std::unique_ptr > ()))); } -#line 5363 "seclang-parser.cc" // lalr1.cc:870 +#line 5365 "seclang-parser.cc" // lalr1.cc:870 break; case 435: -#line 3066 "seclang-parser.yy" // lalr1.cc:870 +#line 3068 "seclang-parser.yy" // lalr1.cc:870 { yystack_[1].value.as< std::unique_ptr > ()->appendText(yystack_[0].value.as< std::string > ()); yylhs.value.as< std::unique_ptr > () = std::move(yystack_[1].value.as< std::unique_ptr > ()); } -#line 5372 "seclang-parser.cc" // lalr1.cc:870 +#line 5374 "seclang-parser.cc" // lalr1.cc:870 break; case 436: -#line 3071 "seclang-parser.yy" // lalr1.cc:870 +#line 3073 "seclang-parser.yy" // lalr1.cc:870 { yystack_[1].value.as< std::unique_ptr > ()->appendVar(std::move(yystack_[0].value.as< std::unique_ptr > ())); yylhs.value.as< std::unique_ptr > () = std::move(yystack_[1].value.as< std::unique_ptr > ()); } -#line 5381 "seclang-parser.cc" // lalr1.cc:870 +#line 5383 "seclang-parser.cc" // lalr1.cc:870 break; case 437: -#line 3076 "seclang-parser.yy" // lalr1.cc:870 +#line 3078 "seclang-parser.yy" // lalr1.cc:870 { std::unique_ptr r(new RunTimeString()); r->appendText(yystack_[0].value.as< std::string > ()); yylhs.value.as< std::unique_ptr > () = std::move(r); } -#line 5391 "seclang-parser.cc" // lalr1.cc:870 +#line 5393 "seclang-parser.cc" // lalr1.cc:870 break; case 438: -#line 3082 "seclang-parser.yy" // lalr1.cc:870 +#line 3084 "seclang-parser.yy" // lalr1.cc:870 { std::unique_ptr r(new RunTimeString()); r->appendVar(std::move(yystack_[0].value.as< std::unique_ptr > ())); yylhs.value.as< std::unique_ptr > () = std::move(r); } -#line 5401 "seclang-parser.cc" // lalr1.cc:870 +#line 5403 "seclang-parser.cc" // lalr1.cc:870 break; -#line 5405 "seclang-parser.cc" // lalr1.cc:870 +#line 5407 "seclang-parser.cc" // lalr1.cc:870 default: break; } @@ -6824,35 +6826,35 @@ namespace yy { 1462, 1475, 1501, 1529, 1541, 1561, 1589, 1594, 1599, 1608, 1613, 1617, 1621, 1625, 1629, 1633, 1637, 1642, 1647, 1659, 1665, 1669, 1673, 1684, 1693, 1694, 1701, 1706, 1711, 1726, - 1806, 1813, 1821, 1858, 1862, 1869, 1874, 1880, 1886, 1892, - 1899, 1909, 1913, 1917, 1921, 1925, 1929, 1933, 1937, 1941, - 1945, 1949, 1953, 1957, 1961, 1965, 1969, 1973, 1977, 1981, - 1985, 1989, 1993, 1997, 2001, 2005, 2009, 2013, 2017, 2021, - 2025, 2029, 2033, 2037, 2041, 2045, 2049, 2053, 2057, 2061, - 2065, 2069, 2073, 2077, 2081, 2085, 2089, 2093, 2097, 2101, - 2105, 2109, 2113, 2117, 2121, 2125, 2129, 2133, 2137, 2141, - 2145, 2149, 2153, 2157, 2161, 2165, 2169, 2173, 2177, 2181, - 2185, 2189, 2193, 2197, 2201, 2205, 2209, 2213, 2217, 2221, - 2225, 2229, 2233, 2237, 2241, 2245, 2249, 2253, 2257, 2261, - 2265, 2270, 2274, 2278, 2283, 2287, 2291, 2296, 2301, 2305, - 2309, 2313, 2317, 2321, 2325, 2329, 2333, 2337, 2341, 2345, - 2349, 2353, 2357, 2361, 2365, 2369, 2373, 2377, 2381, 2385, - 2389, 2393, 2397, 2401, 2405, 2409, 2413, 2417, 2421, 2425, - 2429, 2433, 2437, 2441, 2445, 2449, 2453, 2457, 2461, 2465, - 2469, 2473, 2477, 2481, 2485, 2489, 2493, 2497, 2501, 2505, - 2509, 2513, 2517, 2521, 2525, 2529, 2533, 2537, 2541, 2549, - 2556, 2563, 2570, 2577, 2584, 2591, 2598, 2605, 2612, 2619, - 2626, 2636, 2640, 2644, 2648, 2652, 2656, 2660, 2664, 2669, - 2674, 2679, 2683, 2687, 2691, 2695, 2700, 2705, 2709, 2713, - 2717, 2721, 2725, 2729, 2733, 2737, 2741, 2745, 2749, 2754, - 2758, 2763, 2767, 2771, 2775, 2779, 2783, 2787, 2791, 2795, - 2799, 2803, 2807, 2811, 2815, 2819, 2823, 2827, 2831, 2835, - 2839, 2843, 2847, 2851, 2855, 2859, 2863, 2867, 2871, 2875, - 2879, 2883, 2887, 2891, 2895, 2899, 2903, 2907, 2911, 2915, - 2919, 2923, 2927, 2931, 2935, 2939, 2943, 2947, 2951, 2955, - 2959, 2963, 2967, 2971, 2975, 2979, 2983, 2987, 2991, 2995, - 2999, 3003, 3007, 3011, 3015, 3019, 3023, 3027, 3031, 3035, - 3042, 3046, 3050, 3054, 3058, 3065, 3070, 3075, 3081 + 1808, 1815, 1823, 1860, 1864, 1871, 1876, 1882, 1888, 1894, + 1901, 1911, 1915, 1919, 1923, 1927, 1931, 1935, 1939, 1943, + 1947, 1951, 1955, 1959, 1963, 1967, 1971, 1975, 1979, 1983, + 1987, 1991, 1995, 1999, 2003, 2007, 2011, 2015, 2019, 2023, + 2027, 2031, 2035, 2039, 2043, 2047, 2051, 2055, 2059, 2063, + 2067, 2071, 2075, 2079, 2083, 2087, 2091, 2095, 2099, 2103, + 2107, 2111, 2115, 2119, 2123, 2127, 2131, 2135, 2139, 2143, + 2147, 2151, 2155, 2159, 2163, 2167, 2171, 2175, 2179, 2183, + 2187, 2191, 2195, 2199, 2203, 2207, 2211, 2215, 2219, 2223, + 2227, 2231, 2235, 2239, 2243, 2247, 2251, 2255, 2259, 2263, + 2267, 2272, 2276, 2280, 2285, 2289, 2293, 2298, 2303, 2307, + 2311, 2315, 2319, 2323, 2327, 2331, 2335, 2339, 2343, 2347, + 2351, 2355, 2359, 2363, 2367, 2371, 2375, 2379, 2383, 2387, + 2391, 2395, 2399, 2403, 2407, 2411, 2415, 2419, 2423, 2427, + 2431, 2435, 2439, 2443, 2447, 2451, 2455, 2459, 2463, 2467, + 2471, 2475, 2479, 2483, 2487, 2491, 2495, 2499, 2503, 2507, + 2511, 2515, 2519, 2523, 2527, 2531, 2535, 2539, 2543, 2551, + 2558, 2565, 2572, 2579, 2586, 2593, 2600, 2607, 2614, 2621, + 2628, 2638, 2642, 2646, 2650, 2654, 2658, 2662, 2666, 2671, + 2676, 2681, 2685, 2689, 2693, 2697, 2702, 2707, 2711, 2715, + 2719, 2723, 2727, 2731, 2735, 2739, 2743, 2747, 2751, 2756, + 2760, 2765, 2769, 2773, 2777, 2781, 2785, 2789, 2793, 2797, + 2801, 2805, 2809, 2813, 2817, 2821, 2825, 2829, 2833, 2837, + 2841, 2845, 2849, 2853, 2857, 2861, 2865, 2869, 2873, 2877, + 2881, 2885, 2889, 2893, 2897, 2901, 2905, 2909, 2913, 2917, + 2921, 2925, 2929, 2933, 2937, 2941, 2945, 2949, 2953, 2957, + 2961, 2965, 2969, 2973, 2977, 2981, 2985, 2989, 2993, 2997, + 3001, 3005, 3009, 3013, 3017, 3021, 3025, 3029, 3033, 3037, + 3044, 3048, 3052, 3056, 3060, 3067, 3072, 3077, 3083 }; // Print the state stack on the debug stream. @@ -6887,8 +6889,8 @@ namespace yy { } // yy -#line 6891 "seclang-parser.cc" // lalr1.cc:1181 -#line 3088 "seclang-parser.yy" // lalr1.cc:1182 +#line 6893 "seclang-parser.cc" // lalr1.cc:1181 +#line 3090 "seclang-parser.yy" // lalr1.cc:1182 void yy::seclang_parser::error (const location_type& l, const std::string& m) { diff --git a/src/request_body_processor/json.h b/src/request_body_processor/json.h index 2b1aa814..8c4c502d 100644 --- a/src/request_body_processor/json.h +++ b/src/request_body_processor/json.h @@ -79,12 +79,6 @@ class JSON { static int yajl_start_array(void *ctx); static int yajl_end_array(void *ctx); -#ifndef NO_LOGS - void debug(int a, std::string str) { - m_transaction->debug(a, str); - } -#endif - bool isPreviousArray() { JSONContainerArray *prev = NULL; if (m_containers.size() < 1) { diff --git a/src/request_body_processor/multipart.cc b/src/request_body_processor/multipart.cc index 9238d472..fdadc42a 100644 --- a/src/request_body_processor/multipart.cc +++ b/src/request_body_processor/multipart.cc @@ -69,12 +69,11 @@ Multipart::Multipart(std:: string header, Transaction *transaction) Multipart::~Multipart() { -#ifndef NO_LOGS - debug(4, "Multipart: Cleanup started (remove files " \ + ms_dbg_a(m_transaction, 4, + "Multipart: Cleanup started (remove files " \ + RulesProperties::configBooleanString( m_transaction->m_rules->m_uploadKeepFiles) \ + ")"); -#endif if (m_transaction->m_rules->m_uploadKeepFiles != RulesProperties::TrueConfigBoolean) { @@ -86,21 +85,21 @@ Multipart::~Multipart() { close(m->m_tmp_file_fd); m->m_tmp_file_fd = -1; } -#ifndef NO_LOGS const int unlink_rc = -#endif unlink(m->m_tmp_file_name.c_str()); -#ifndef NO_LOGS + if (unlink_rc < 0) { - debug(1, "Multipart: Failed to delete file (part) \"" \ + ms_dbg_a(m_transaction, 1, + "Multipart: Failed to delete file (part) \"" \ + m->m_tmp_file_name + "\" because " \ + std::to_string(errno) + "(" \ + strerror(errno) + ")"); } else { - debug(4, "Multipart: Failed to delete file (part) \"" \ + ms_dbg_a(m_transaction, 4, + "Multipart: Failed to delete file (part) \"" \ + m->m_tmp_file_name + "\""); } -#endif + } } } @@ -211,11 +210,10 @@ void Multipart::validate_quotes(const char *data) { for (i = 0; i < len; i++) { if (data[i] == '\'') { -#ifndef NO_LOGS - debug(9, "Multipart: Invalid quoting detected: " \ + ms_dbg_a(m_transaction, 9, + "Multipart: Invalid quoting detected: " \ + std::string(data) + " length " \ + std::to_string(len) + " bytes"); -#endif m_flag_invalid_quoting = 1; } } @@ -356,36 +354,32 @@ int Multipart::parse_content_disposition(const char *c_d_value, int offset) { offset + ((p - c_d_value) - value.size())); if (!m_mpp->m_name.empty()) { -#ifndef NO_LOGS - debug(4, "Multipart: Warning: Duplicate Content-Disposition " \ + ms_dbg_a(m_transaction, 4, + "Multipart: Warning: Duplicate Content-Disposition " \ "name: " + value + ". Previously: " + m_mpp->m_name + ""); -#endif return -14; } m_mpp->m_name.assign(value); m_mpp->m_nameOffset = offset + ((p - c_d_value) - value.size()); -#ifndef NO_LOGS - debug(9, "Multipart: Content-Disposition name: " + value + "."); -#endif + ms_dbg_a(m_transaction, 9, + "Multipart: Content-Disposition name: " + value + "."); } else if (name == "filename") { validate_quotes(value.c_str()); m_transaction->m_variableMultipartFileName.set(value, value, \ offset + ((p - c_d_value) - value.size())); if (!m_mpp->m_filename.empty()) { -#ifndef NO_LOGS - debug(4, "Multipart: Warning: Duplicate Content-Disposition " \ + ms_dbg_a(m_transaction, 4, + "Multipart: Warning: Duplicate Content-Disposition " \ "filename: " + value + "."); -#endif return -15; } m_mpp->m_filename.assign(value); m_mpp->m_filenameOffset = offset + ((p - c_d_value) - value.size()); -#ifndef NO_LOGS - debug(9, "Multipart: Content-Disposition filename: " \ + ms_dbg_a(m_transaction, 9, + "Multipart: Content-Disposition filename: " \ + value + "."); -#endif } else { return -11; } @@ -402,11 +396,10 @@ int Multipart::parse_content_disposition(const char *c_d_value, int offset) { if (*p != ';') { p--; if (*p == '\'' || *p == '\"') { -#ifndef NO_LOGS - debug(9, "Multipart: Invalid quoting detected: " \ + ms_dbg_a(m_transaction, 9, + "Multipart: Invalid quoting detected: " \ + std::string(p) + " length " \ + std::to_string(strlen(p)) + " bytes"); -#endif m_flag_invalid_quoting = 1; } p++; @@ -497,12 +490,11 @@ int Multipart::process_part_data(std::string *error, size_t offset) { && (m_nfiles >= m_transaction->m_rules->m_uploadFileLimit.m_value)) { if (m_flag_file_limit_exceeded == 0) { -#ifndef NO_LOGS - debug(1, "Multipart: Upload file limit exceeded " \ - + std::to_string( - m_transaction->m_rules->m_uploadFileLimit.m_value) \ - + ". Use SecUploadFileLimit to change the limit."); -#endif + ms_dbg_a(m_transaction, 1, + "Multipart: Upload file limit exceeded " \ + + std::to_string( + m_transaction->m_rules->m_uploadFileLimit.m_value) \ + + ". Use SecUploadFileLimit to change the limit."); error->assign("Multipart: Upload file limit exceeded " \ + std::to_string( m_transaction->m_rules->m_uploadFileLimit.m_value) \ @@ -525,10 +517,9 @@ int Multipart::process_part_data(std::string *error, size_t offset) { /* do we have an opened file? */ if (m_mpp->m_tmp_file_fd < 0) { -#ifndef NO_LOGS - debug(1, "Multipart: Failed to create file: " \ + ms_dbg_a(m_transaction, 1, + "Multipart: Failed to create file: " \ + m_mpp->m_tmp_file_name); -#endif error->assign("Multipart: Failed to create file: " \ + m_mpp->m_tmp_file_name); return -1; @@ -537,21 +528,19 @@ int Multipart::process_part_data(std::string *error, size_t offset) { m_nfiles++; -#ifndef NO_LOGS - debug(4, "Multipart: Created temporary file " \ + ms_dbg_a(m_transaction, 4, + "Multipart: Created temporary file " \ + std::to_string(m_nfiles) + " (mode 04o): " \ + m_mpp->m_tmp_file_name); -#endif } /* write the reserve first */ if (m_reserve[0] != 0) { if (write(m_mpp->m_tmp_file_fd, &m_reserve[1], m_reserve[0]) != m_reserve[0]) { -#ifndef NO_LOGS - debug(1, "Multipart: writing to \"" \ + ms_dbg_a(m_transaction, 1, + "Multipart: writing to \"" \ + m_mpp->m_tmp_file_name + "\" failed"); -#endif error->assign("Multipart: writing to \"" \ + m_mpp->m_tmp_file_name + "\" failed"); return -1; @@ -570,10 +559,9 @@ int Multipart::process_part_data(std::string *error, size_t offset) { if (write(m_mpp->m_tmp_file_fd, m_buf, MULTIPART_BUF_SIZE - m_bufleft) != (MULTIPART_BUF_SIZE - m_bufleft)) { -#ifndef NO_LOGS - debug(1, "Multipart: writing to \"" \ + ms_dbg_a(m_transaction, 1, + "Multipart: writing to \"" \ + m_mpp->m_tmp_file_name + "\" failed"); -#endif error->assign("Multipart: writing to \"" \ + m_mpp->m_tmp_file_name + "\" failed"); return -1; @@ -627,14 +615,13 @@ int Multipart::process_part_data(std::string *error, size_t offset) { m_mpp->m_value_parts.push_back(std::make_pair(d, m_buf_offset)); -#ifndef NO_LOGS - debug(9, "Multipart: Added data to variable: " + d); -#endif + ms_dbg_a(m_transaction, 9, + "Multipart: Added data to variable: " + d); } else { -#ifndef NO_LOGS - debug(1, "Multipart: unknown part type: " \ + ms_dbg_a(m_transaction, 1, + "Multipart: unknown part type: " \ + std::to_string(m_mpp->m_type)); -#endif + error->assign("Multipart: unknown part type: " \ + std::to_string(m_mpp->m_type)); return false; @@ -664,9 +651,9 @@ int Multipart::process_part_header(std::string *error, int offset) { len = MULTIPART_BUF_SIZE - m_bufleft; for (i = 0; i < len; i++) { if (m_buf[i] == '\0') { -#ifndef NO_LOGS - debug(1, "Multipart: Nul byte in part headers."); -#endif + ms_dbg_a(m_transaction, 1, + "Multipart: Nul byte in part headers."); + error->assign("Multipart: Nul byte in part headers."); return false; } @@ -693,9 +680,9 @@ int Multipart::process_part_header(std::string *error, int offset) { int rc; if (m_mpp->m_headers.count("Content-Disposition") == 0) { -#ifndef NO_LOGS - debug(1, "Multipart: Part missing Content-Disposition header."); -#endif + ms_dbg_a(m_transaction, 1, + "Multipart: Part missing Content-Disposition header."); + error->assign("Multipart: Part missing " \ "Content-Disposition header."); return false; @@ -705,20 +692,20 @@ int Multipart::process_part_header(std::string *error, int offset) { rc = parse_content_disposition(header_value.c_str(), m_mpp->m_headers.at("Content-Disposition").first); if (rc < 0) { -#ifndef NO_LOGS - debug(1, "Multipart: Invalid Content-Disposition header (" + ms_dbg_a(m_transaction, 1, + "Multipart: Invalid Content-Disposition header (" + std::to_string(rc) + "): " + header_value); -#endif + error->assign("Multipart: Invalid Content-Disposition header (" + std::to_string(rc) + "): " + header_value); return false; } if (m_mpp->m_name.empty()) { -#ifndef NO_LOGS - debug(1, "Multipart: Content-Disposition header missing " \ + ms_dbg_a(m_transaction, 1, + "Multipart: Content-Disposition header missing " \ "name field."); -#endif + error->assign("Multipart: Content-Disposition header missing " \ "name field."); @@ -731,10 +718,10 @@ int Multipart::process_part_header(std::string *error, int offset) { * didn't understand C-D but we did. */ if (strstr(header_value.c_str(), "filename=") == NULL) { -#ifndef NO_LOGS - debug(1, "Multipart: Invalid Content-Disposition " \ + ms_dbg_a(m_transaction, 1, + "Multipart: Invalid Content-Disposition " \ "header (filename)."); -#endif + error->assign("Multipart: Invalid Content-Disposition " \ "header (filename)."); return false; @@ -766,9 +753,9 @@ int Multipart::process_part_header(std::string *error, int offset) { if (m_mpp->m_last_header_name.empty()) { /* we are not building a header at this moment */ -#ifndef NO_LOGS - debug(1, "Multipart: Invalid part header (folding error)."); -#endif + ms_dbg_a(m_transaction, 1, + "Multipart: Invalid part header (folding error)."); + error->assign("Multipart: Invalid part header " \ "(folding error)."); return false; @@ -796,16 +783,14 @@ int Multipart::process_part_header(std::string *error, int offset) { new_value = header_value + " " + new_value; m_mpp->m_headers.at(m_mpp->m_last_header_name).second = new_value; -#ifndef NO_LOGS - debug(9, "Multipart: Continued folder header \"" \ + ms_dbg_a(m_transaction, 9, + "Multipart: Continued folder header \"" \ + m_mpp->m_last_header_name + "\" with \"" \ + std::string(data) + "\""); -#endif if (new_value.size() > MULTIPART_BUF_SIZE) { -#ifndef NO_LOGS - debug(1, "Multipart: Part header too long."); -#endif + ms_dbg_a(m_transaction, 1, "Multipart: Part header too long."); + error->assign("Multipart: Part header too long."); return false; } @@ -821,10 +806,10 @@ int Multipart::process_part_header(std::string *error, int offset) { i++; } if (*data == '\0') { -#ifndef NO_LOGS - debug(1, "Multipart: Invalid part header (colon missing): " \ + ms_dbg_a(m_transaction, 1, + "Multipart: Invalid part header (colon missing): " \ + std::string(m_buf)); -#endif + error->assign("Multipart: Invalid part header " \ "(colon missing): " + std::string(m_buf)); return false; @@ -833,10 +818,10 @@ int Multipart::process_part_header(std::string *error, int offset) { /* extract header name */ header_name = std::string(m_buf, data - m_buf); if (data == m_buf) { -#ifndef NO_LOGS - debug(1, "Multipart: Invalid part header " \ + ms_dbg_a(m_transaction, 1, + "Multipart: Invalid part header " \ "(header name missing)."); -#endif + error->assign("Multipart: Invalid part header " \ "(header name missing)."); return false; @@ -854,10 +839,10 @@ int Multipart::process_part_header(std::string *error, int offset) { /* error if the name already exists */ if (m_mpp->m_headers.count(header_name) > 0) { -#ifndef NO_LOGS - debug(1, "Multipart: Duplicate part header: " \ + ms_dbg_a(m_transaction, 1, + "Multipart: Duplicate part header: " \ + header_name + "."); -#endif + return false; } @@ -868,11 +853,9 @@ int Multipart::process_part_header(std::string *error, int offset) { std::string(header_name), std::make_pair(offset - len + i, std::string(header_value))); - -#ifndef NO_LOGS - debug(9, "Multipart: Added part header \"" + header_name \ + ms_dbg_a(m_transaction, 9, + "Multipart: Added part header \"" + header_name \ + "\" \"" + header_value + "\"."); -#endif } } @@ -904,27 +887,28 @@ int Multipart::process_boundary(int last_part) { if (m_mpp->m_name.empty() == false) { /* add the part to the list of parts */ m_parts.push_back(m_mpp); -#ifndef NO_LOGS + if (m_mpp->m_type == MULTIPART_FILE) { - debug(9, "Multipart: Added file part to the list: name \"" \ + ms_dbg_a(m_transaction, 9, + "Multipart: Added file part to the list: name \"" \ + m_mpp->m_name + "\" " "file name \"" + m_mpp->m_filename + "\" (offset " \ + std::to_string(m_mpp->m_offset) + ", length " + std::to_string(m_mpp->m_length) + ")"); } else { - debug(9, "Multipart: Added part to the list: name \"" \ + ms_dbg_a(m_transaction, 9, + "Multipart: Added part to the list: name \"" \ + m_mpp->m_name + "\" " "(offset " + std::to_string(m_mpp->m_offset) \ + ", length " + std::to_string(m_mpp->m_length) + ")"); } -#endif } else { m_flag_invalid_part = true; -#ifndef NO_LOGS - debug(3, "Multipart: Skipping invalid part (part name missing): " + ms_dbg_a(m_transaction, 3, + "Multipart: Skipping invalid part (part name missing): " "(offset " + std::to_string(m_mpp->m_offset) + ", length " + std::to_string(m_mpp->m_length) + ")"); -#endif + delete m_mpp; } @@ -960,45 +944,40 @@ int Multipart::multipart_complete(std::string *error) { std::to_string(m_flag_data_before), m_transaction->m_variableOffset); if (m_flag_data_before) { -#ifndef NO_LOGS - debug(4, "Multipart: Warning: seen data before first boundary."); -#endif + ms_dbg_a(m_transaction, 4, + "Multipart: Warning: seen data before first boundary."); } m_transaction->m_variableMultipartDataAfter.set( std::to_string(m_flag_data_after), m_transaction->m_variableOffset); if (m_flag_data_after) { -#ifndef NO_LOGS - debug(4, "Multipart: Warning: seen data after last boundary."); -#endif + ms_dbg_a(m_transaction, 4, + "Multipart: Warning: seen data after last boundary."); } m_transaction->m_variableMultipartBoundaryQuoted.set( std::to_string(m_flag_boundary_quoted), m_transaction->m_variableOffset); if (m_flag_boundary_quoted) { -#ifndef NO_LOGS - debug(4, "Multipart: Warning: boundary was quoted."); -#endif + ms_dbg_a(m_transaction, 4, + "Multipart: Warning: boundary was quoted."); } m_transaction->m_variableMultipartBoundaryWhiteSpace.set( std::to_string(m_flag_boundary_whitespace), m_transaction->m_variableOffset); if (m_flag_boundary_whitespace) { -#ifndef NO_LOGS - debug(4, "Multipart: Warning: boundary whitespace in C-T header."); -#endif + ms_dbg_a(m_transaction, 4, + "Multipart: Warning: boundary whitespace in C-T header."); } m_transaction->m_variableMultipartHeaderFolding.set( std::to_string(m_flag_header_folding), m_transaction->m_variableOffset); if (m_flag_header_folding) { -#ifndef NO_LOGS - debug(4, "Multipart: Warning: header folding used."); -#endif + ms_dbg_a(m_transaction, 4, + "Multipart: Warning: header folding used."); } m_transaction->m_variableMultipartLFLine.set( std::to_string(m_flag_lf_line), @@ -1007,47 +986,41 @@ int Multipart::multipart_complete(std::string *error) { std::to_string(m_flag_crlf_line && m_flag_lf_line), m_transaction->m_variableOffset); if (m_flag_crlf_line && m_flag_lf_line) { -#ifndef NO_LOGS - debug(4, "Multipart: Warning: mixed line endings used (CRLF/LF)."); -#endif + ms_dbg_a(m_transaction, 4, + "Multipart: Warning: mixed line endings used (CRLF/LF)."); } else if (m_flag_lf_line) { -#ifndef NO_LOGS - debug(4, "Multipart: Warning: incorrect line endings used (LF)."); -#endif + ms_dbg_a(m_transaction, 4, + "Multipart: Warning: incorrect line endings used (LF)."); } m_transaction->m_variableMultipartMissingSemicolon.set( std::to_string(m_flag_missing_semicolon), m_transaction->m_variableOffset); if (m_flag_missing_semicolon) { -#ifndef NO_LOGS - debug(4, "Multipart: Warning: missing semicolon in C-T header."); -#endif + ms_dbg_a(m_transaction, 4, + "Multipart: Warning: missing semicolon in C-T header."); } m_transaction->m_variableMultipartInvalidQuoting.set( std::to_string(m_flag_invalid_quoting), m_transaction->m_variableOffset); if (m_flag_invalid_quoting) { -#ifndef NO_LOGS - debug(4, "Multipart: Warning: invalid quoting used."); -#endif + ms_dbg_a(m_transaction, 4, + "Multipart: Warning: invalid quoting used."); } m_transaction->m_variableMultipartInvalidPart.set( std::to_string(m_flag_invalid_part), m_transaction->m_variableOffset); if (m_flag_invalid_part) { -#ifndef NO_LOGS - debug(4, "Multipart: Warning: invalid part parsing."); -#endif + ms_dbg_a(m_transaction, 4, + "Multipart: Warning: invalid part parsing."); } m_transaction->m_variableMultipartInvalidHeaderFolding.set( std::to_string(m_flag_invalid_header_folding), m_transaction->m_variableOffset); if (m_flag_invalid_header_folding) { -#ifndef NO_LOGS - debug(4, "Multipart: Warning: invalid header folding used."); -#endif + ms_dbg_a(m_transaction, 4, + "Multipart: Warning: invalid header folding used."); } m_transaction->m_variableMultipartStrictError.set( @@ -1086,16 +1059,14 @@ int Multipart::multipart_complete(std::string *error) { } if (m_is_complete == 0) { -#ifndef NO_LOGS - debug(1, "Multipart: Final boundary missing."); -#endif + ms_dbg_a(m_transaction, 1, + "Multipart: Final boundary missing."); error->assign("Multipart: Final boundary missing."); return false; } } else { -#ifndef NO_LOGS - debug(1, "Multipart: No boundaries found in payload."); -#endif + ms_dbg_a(m_transaction, 1, + "Multipart: No boundaries found in payload."); error->assign("Multipart: No boundaries found in payload."); return false; } @@ -1143,10 +1114,9 @@ int Multipart::multipart_complete(std::string *error) { std::to_string(file_combined_size), m->m_tmp_file_size.second, m->m_tmp_file_size.first); } else { -#ifndef NO_LOGS - debug(4, "Adding request argument (BODY): name \"" + + ms_dbg_a(m_transaction, 4, + "Adding request argument (BODY): name \"" + m->m_name + "\", value \"" + m->m_value + "\""); -#endif m_transaction->m_variableArgs.set(m->m_name, m->m_value, offset + m->m_valueOffset); m_transaction->m_variableArgsPost.set(m->m_name, m->m_value, @@ -1217,27 +1187,23 @@ bool Multipart::init(std::string *error) { if (m_header.empty()) { m_flag_error = true; -#ifndef NO_LOGS - debug(4, "Multipart: Content-Type header not available."); -#endif + ms_dbg_a(m_transaction, 4, + "Multipart: Content-Type header not available."); error->assign("Multipart: Content-Type header not available."); return false; } if (m_header.size() > 1024) { m_flag_error = 1; -#ifndef NO_LOGS - debug(4, "Multipart: Invalid boundary in C-T (length)."); -#endif + ms_dbg_a(m_transaction, 4, + "Multipart: Invalid boundary in C-T (length)."); error->assign("Multipart: Invalid boundary in C-T (length)."); return false; } if (strncasecmp(m_header.c_str(), "multipart/form-data", 19) != 0) { m_flag_error = 1; -#ifndef NO_LOGS - debug(4, "Multipart: Invalid MIME type."); -#endif + ms_dbg_a(m_transaction, 4, "Multipart: Invalid MIME type."); error->assign("Multipart: Invalid MIME type."); return false; } @@ -1245,9 +1211,8 @@ bool Multipart::init(std::string *error) { /* Count how many times the word "boundary" appears in the C-T header. */ if (count_boundary_params(m_header) > 1) { m_flag_error = 1; -#ifndef NO_LOGS - debug(4, "Multipart: Multiple boundary parameters in C-T."); -#endif + ms_dbg_a(m_transaction, 4, + "Multipart: Multiple boundary parameters in C-T."); error->assign("Multipart: Multiple boundary parameters in C-T."); return false; } @@ -1268,10 +1233,9 @@ bool Multipart::init(std::string *error) { seen_semicolon = 1; /* It is OK to have one semicolon. */ } else { m_flag_error = 1; -#ifndef NO_LOGS - debug(4, "Multipart: Invalid boundary in C-T " \ + ms_dbg_a(m_transaction, 4, + "Multipart: Invalid boundary in C-T " \ "(malformed)."); -#endif error->assign("Multipart: Invalid boundary in C-T " \ "(malformed)."); return false; @@ -1287,9 +1251,8 @@ bool Multipart::init(std::string *error) { b = strchr(m_boundary_tmp + 8, '='); if (b == NULL) { m_flag_error = 1; -#ifndef NO_LOGS - debug(4, "Multipart: Invalid boundary in C-T (malformed)."); -#endif + ms_dbg_a(m_transaction, 4, + "Multipart: Invalid boundary in C-T (malformed)."); error->assign("Multipart: Invalid boundary in C-T (malformed)."); return false; } @@ -1305,10 +1268,9 @@ bool Multipart::init(std::string *error) { m_flag_boundary_whitespace = 1; } else { m_flag_error = 1; -#ifndef NO_LOGS - debug(4, "Multipart: Invalid boundary in C-T " \ + ms_dbg_a(m_transaction, 4, + "Multipart: Invalid boundary in C-T " \ "(parameter name)."); -#endif error->assign("Multipart: Invalid boundary in C-T " \ "(parameter name)."); return false; @@ -1339,9 +1301,8 @@ bool Multipart::init(std::string *error) { if ((*b == '"') || ((len >= 2) && (*(b + len - 1) == '"'))) { m_flag_error = 1; -#ifndef NO_LOGS - debug(4, "Multipart: Invalid boundary in C-T (quote)."); -#endif + ms_dbg_a(m_transaction, 4, + "Multipart: Invalid boundary in C-T (quote)."); error->assign("Multipart: Invalid boundary in C-T (quote)."); return false; } @@ -1357,9 +1318,8 @@ bool Multipart::init(std::string *error) { /* Case-insensitive test for the string "boundary" in the boundary. */ if (count_boundary_params(m_boundary) != 0) { m_flag_error = 1; -#ifndef NO_LOGS - debug(4, "Multipart: Invalid boundary in C-T (content)."); -#endif + ms_dbg_a(m_transaction, 4, + "Multipart: Invalid boundary in C-T (content)."); error->assign("Multipart: Invalid boundary in C-T (content)."); return false; } @@ -1367,25 +1327,21 @@ bool Multipart::init(std::string *error) { /* Validate the characters used in the boundary. */ if (boundary_characters_valid(m_boundary.c_str()) != 1) { m_flag_error = 1; -#ifndef NO_LOGS - debug(4, "Multipart: Invalid boundary in C-T (characters)."); -#endif + ms_dbg_a(m_transaction, 4, + "Multipart: Invalid boundary in C-T (characters)."); error->assign("Multipart: Invalid boundary in C-T (characters)."); return false; } -#ifndef NO_LOGS - debug(9, "Multipart: Boundary" + + ms_dbg_a(m_transaction, 9, "Multipart: Boundary" + (m_flag_boundary_quoted ? std::string(" (quoted)") : std::string("")) + std::string(": ") + m_boundary); -#endif if (m_boundary.size() == 0) { m_flag_error = 1; -#ifndef NO_LOGS - debug(4, "Multipart: Invalid boundary in C-T (empty)."); -#endif + ms_dbg_a(m_transaction, 4, + "Multipart: Invalid boundary in C-T (empty)."); error->assign("Multipart: Invalid boundary in C-T (empty)."); return false; } @@ -1395,17 +1351,14 @@ bool Multipart::init(std::string *error) { /* Test for case-insensitive boundary. Allowed by the RFC but * highly unusual. */ if (count_boundary_params(m_header) > 0) { -#ifndef NO_LOGS - debug(4, "Multipart: Invalid boundary in C-T (case sensitivity)."); -#endif + ms_dbg_a(m_transaction, 4, + "Multipart: Invalid boundary in C-T (case sensitivity)."); error->assign("Multipart: Invalid boundary in C-T " \ "(case sensitivity)."); return false; } -#ifndef NO_LOGS - debug(4, "Multipart: Boundary not found in C-T."); -#endif + ms_dbg_a(m_transaction, 4, "Multipart: Boundary not found in C-T."); error->assign("Multipart: Boundary not found in C-T."); return false; } @@ -1430,20 +1383,18 @@ bool Multipart::process(const std::string& data, std::string *error, if (m_is_complete) { m_flag_data_before = true; -#ifndef NO_LOGS - debug(4, "Multipart: Ignoring data after last boundary (received " \ + ms_dbg_a(m_transaction, 4, + "Multipart: Ignoring data after last boundary (received " \ + std::to_string(data.size()) + " bytes)"); -#endif return true; } if (m_bufleft == 0) { m_flag_error = 1; -#ifndef NO_LOGS - debug(4, "Multipart: Internal error in process_chunk: no space left " \ + ms_dbg_a(m_transaction, 4, + "Multipart: Internal error in process_chunk: no space left " \ "in the buffer"); -#endif return false; } @@ -1503,10 +1454,10 @@ bool Multipart::process(const std::string& data, std::string *error, if (m_is_complete != 0) { m_flag_error = 1; -#ifndef NO_LOGS - debug(4, "Multipart: Invalid boundary " \ + ms_dbg_a(m_transaction, 4, + "Multipart: Invalid boundary " \ "(final duplicate)."); -#endif + error->assign("Multipart: Invalid boundary " \ "(final duplicate)."); return false; @@ -1539,10 +1490,9 @@ bool Multipart::process(const std::string& data, std::string *error, } else { /* error */ m_flag_error = 1; -#ifndef NO_LOGS - debug(4, "Multipart: Invalid boundary: " \ + ms_dbg_a(m_transaction, 4, + "Multipart: Invalid boundary: " \ + std::string(m_buf)); -#endif error->assign("Multipart: Invalid boundary: " \ + std::string(m_buf)); return false; @@ -1559,9 +1509,8 @@ bool Multipart::process(const std::string& data, std::string *error, && (strncmp(m_buf + 3, m_boundary.c_str(), m_boundary.size()) == 0)) { m_flag_error = 1; -#ifndef NO_LOGS - debug(4, "Multipart: Invalid boundary (quotes)."); -#endif + ms_dbg_a(m_transaction, 4, + "Multipart: Invalid boundary (quotes)."); error->assign("Multipart: Invalid boundary (quotes)."); return false; } @@ -1577,9 +1526,8 @@ bool Multipart::process(const std::string& data, std::string *error, m_boundary.size()) == 0)) { /* Found whitespace in front of a boundary. */ m_flag_error = 1; -#ifndef NO_LOGS - debug(4, "Multipart: Invalid boundary (whitespace)."); -#endif + ms_dbg_a(m_transaction, 4, + "Multipart: Invalid boundary (whitespace)."); error->assign("Multipart: Invalid boundary " \ "(whitespace)."); return false; @@ -1612,11 +1560,9 @@ bool Multipart::process(const std::string& data, std::string *error, if (processed_as_boundary == 0) { if (m_mpp == NULL) { m_flag_data_before = 1; - -#ifndef NO_LOGS - debug(4, "Multipart: Ignoring data before first " \ + ms_dbg_a(m_transaction, 4, + "Multipart: Ignoring data before first " \ "boundary."); -#endif } else { if (m_mpp_state == 0) { if ((m_bufleft == 0) || (process_buffer)) { @@ -1624,11 +1570,10 @@ bool Multipart::process(const std::string& data, std::string *error, * MULTIPART_BUF_SIZE bytes */ m_flag_error = 1; -#ifndef NO_LOGS - debug(4, "Multipart: Part header line over " \ + ms_dbg_a(m_transaction, 4, + "Multipart: Part header line over " \ + std::to_string(MULTIPART_BUF_SIZE) \ + " bytes long"); -#endif error->assign("Multipart: Part header line over " \ + std::to_string(MULTIPART_BUF_SIZE) \ + " bytes long"); @@ -1665,11 +1610,9 @@ bool Multipart::process(const std::string& data, std::string *error, if ((m_is_complete) && (inleft != 0)) { m_flag_data_after = 1; -#ifndef NO_LOGS - debug(4, "Multipart: Ignoring data after last boundary (" \ + ms_dbg_a(m_transaction, 4, + "Multipart: Ignoring data after last boundary (" \ + std::to_string(inleft) + "bytes left)"); -#endif - return true; } } diff --git a/src/request_body_processor/multipart.h b/src/request_body_processor/multipart.h index 6d819696..896d11b7 100644 --- a/src/request_body_processor/multipart.h +++ b/src/request_body_processor/multipart.h @@ -189,12 +189,6 @@ class Multipart { int m_flag_invalid_header_folding; int m_flag_file_limit_exceeded; -#ifndef NO_LOGS - void debug(int a, std::string str) { - m_transaction->debug(a, str); - } -#endif - private: std::string m_header; Transaction *m_transaction; diff --git a/src/request_body_processor/xml.cc b/src/request_body_processor/xml.cc index 26d494e1..70796e65 100644 --- a/src/request_body_processor/xml.cc +++ b/src/request_body_processor/xml.cc @@ -75,9 +75,7 @@ bool XML::processChunk(const char *buf, unsigned int size, if (m_data.parsing_ctx == NULL) { /* First invocation. */ -#ifndef NO_LOGS - debug(4, "XML: Initialising parser."); -#endif + ms_dbg_a(m_transaction, 4, "XML: Initialising parser."); /* NOTE When Sax interface is used libxml will not * create the document object, but we need it. @@ -96,9 +94,8 @@ bool XML::processChunk(const char *buf, unsigned int size, buf, size, "body.xml"); if (m_data.parsing_ctx == NULL) { -#ifndef NO_LOGS - debug(4, "XML: Failed to create parsing context."); -#endif + ms_dbg_a(m_transaction, 4, + "XML: Failed to create parsing context."); error->assign("XML: Failed to create parsing context."); return false; } @@ -109,9 +106,7 @@ bool XML::processChunk(const char *buf, unsigned int size, xmlParseChunk(m_data.parsing_ctx, buf, size, 0); if (m_data.parsing_ctx->wellFormed != 1) { error->assign("XML: Failed to create parsing context."); -#ifndef NO_LOGS - debug(4, "XML: Failed parsing document."); -#endif + ms_dbg_a(m_transaction, 4, "XML: Failed parsing document."); return false; } @@ -132,16 +127,12 @@ bool XML::complete(std::string *error) { /* Clean up everything else. */ xmlFreeParserCtxt(m_data.parsing_ctx); m_data.parsing_ctx = NULL; -#ifndef NO_LOGS - debug(4, "XML: Parsing complete (well_formed " \ + ms_dbg_a(m_transaction, 4, "XML: Parsing complete (well_formed " \ + std::to_string(m_data.well_formed) + ")."); -#endif if (m_data.well_formed != 1) { error->assign("XML: Failed parsing document."); -#ifndef NO_LOGS - debug(4, "XML: Failed parsing document."); -#endif + ms_dbg_a(m_transaction, 4, "XML: Failed parsing document."); return false; } } diff --git a/src/request_body_processor/xml.h b/src/request_body_processor/xml.h index 2616c36a..465cc111 100644 --- a/src/request_body_processor/xml.h +++ b/src/request_body_processor/xml.h @@ -53,11 +53,6 @@ class XML { static xmlParserInputBufferPtr unloadExternalEntity(const char *URI, xmlCharEncoding enc); -#ifndef NO_LOGS - void debug(int a, std::string str) { - m_transaction->debug(a, str); - } -#endif xml_data m_data; private: diff --git a/src/rule.cc b/src/rule.cc index 7cc42c03..3b735733 100644 --- a/src/rule.cc +++ b/src/rule.cc @@ -245,9 +245,7 @@ void Rule::cleanUpActions() { inline void Rule::updateMatchedVars(Transaction *trans, const std::string &key, const std::string &value) { -#ifndef NO_LOGS - trans->debug(9, "Matched vars updated."); -#endif + ms_dbg_a(trans, 9, "Matched vars updated."); trans->m_variableMatchedVar.set(value, trans->m_variableOffset); trans->m_variableMatchedVarName.set(key, trans->m_variableOffset); @@ -257,9 +255,7 @@ inline void Rule::updateMatchedVars(Transaction *trans, const std::string &key, inline void Rule::cleanMatchedVars(Transaction *trans) { -#ifndef NO_LOGS - trans->debug(9, "Matched vars cleaned."); -#endif + ms_dbg_a(trans, 9, "Matched vars cleaned."); trans->m_variableMatchedVar.unset(); trans->m_variableMatchedVars.unset(); trans->m_variableMatchedVarName.unset(); @@ -271,10 +267,9 @@ void Rule::executeActionsIndependentOfChainedRuleResult(Transaction *trans, bool *containsBlock, std::shared_ptr ruleMessage) { for (actions::SetVar *a : m_actionsSetVar) { -#ifndef NO_LOGS - trans->debug(4, "Running [independent] (non-disruptive) " \ + ms_dbg_a(trans, 4, "Running [independent] (non-disruptive) " \ "action: " + a->m_name); -#endif + a->evaluate(this, trans); } @@ -285,15 +280,11 @@ void Rule::executeActionsIndependentOfChainedRuleResult(Transaction *trans, } actions::Action *a = dynamic_cast(b.second.get()); if (a->isDisruptive() == true && a->m_name == "block") { -#ifndef NO_LOGS - trans->debug(9, "Rule contains a `block' action"); + ms_dbg_a(trans, 9, "Rule contains a `block' action"); *containsBlock = true; -#endif } else if (a->m_name == "setvar") { -#ifndef NO_LOGS - trans->debug(4, "Running [independent] (non-disruptive) " \ + ms_dbg_a(trans, 4, "Running [independent] (non-disruptive) " \ "action: " + a->m_name); -#endif a->evaluate(this, trans, ruleMessage); } } @@ -321,14 +312,9 @@ bool Rule::executeOperatorAt(Transaction *trans, std::string key, #endif bool ret; -#ifndef NO_LOGS - if (trans && trans->m_rules && trans->m_rules->m_debugLog - && trans->m_rules->m_debugLog->getDebugLogLevel() >= 9) { - trans->debug(9, "Target value: \"" + utils::string::limitTo(80, - utils::string::toHexIfNeeded(value)) \ - + "\" (Variable: " + key + ")"); - } -#endif + ms_dbg_a(trans, 9, "Target value: \"" + utils::string::limitTo(80, + utils::string::toHexIfNeeded(value)) \ + + "\" (Variable: " + key + ")"); ret = this->m_op->evaluateInternal(trans, this, value, ruleMessage); if (ret == false) { @@ -339,10 +325,8 @@ bool Rule::executeOperatorAt(Transaction *trans, std::string key, end = clock(); elapsed_s = static_cast(end - begin) / CLOCKS_PER_SEC; -#ifndef NO_LOGS - trans->debug(5, "Operator completed in " + \ + ms_dbg_a(trans, 5, "Operator completed in " + \ std::to_string(elapsed_s) + " seconds"); -#endif #endif return ret; } @@ -375,12 +359,10 @@ inline void Rule::executeTransformation(actions::Action *a, path->append("," + a->m_name); } -#ifndef NO_LOGS - trans->debug(9, " T (" + \ + ms_dbg_a(trans, 9, " T (" + \ std::to_string(*nth) + ") " + \ a->m_name + ": \"" + \ utils::string::limitTo(80, newValue) +"\""); -#endif } @@ -461,11 +443,9 @@ std::list, } if (m_containsMultiMatchAction == true) { -#ifndef NO_LOGS - trans->debug(9, "multiMatch is enabled. " \ + ms_dbg_a(trans, 9, "multiMatch is enabled. " \ + std::to_string(ret.size()) + \ " values to be tested."); -#endif } if (!m_containsMultiMatchAction) { @@ -570,35 +550,27 @@ void Rule::executeAction(Transaction *trans, bool containsBlock, std::shared_ptr ruleMessage, Action *a, bool defaultContext) { if (a->isDisruptive() == false) { -#ifndef NO_LOGS - trans->debug(9, "Running " \ + ms_dbg_a(trans, 9, "Running " \ "action: " + a->m_name); -#endif a->evaluate(this, trans, ruleMessage); return; } if (defaultContext && !containsBlock) { -#ifndef NO_LOGS - trans->debug(4, "Ignoring action: " + a->m_name + \ + ms_dbg_a(trans, 4, "Ignoring action: " + a->m_name + \ " (rule does not cotains block)"); -#endif return; } if (trans->getRuleEngineState() == Rules::EnabledRuleEngine) { -#ifndef NO_LOGS - trans->debug(4, "Running (disruptive) action: " + a->m_name + \ + ms_dbg_a(trans, 4, "Running (disruptive) action: " + a->m_name + \ "."); -#endif a->evaluate(this, trans, ruleMessage); return; } -#ifndef NO_LOGS - trans->debug(4, "Not running disruptive action: " \ + ms_dbg_a(trans, 4, "Not running disruptive action: " \ + a->m_name + ". SecRuleEngine is not On."); -#endif } @@ -617,10 +589,8 @@ void Rule::executeActionsAfterFullMatch(Transaction *trans, } for (actions::Tag *a : this->m_actionsTag) { -#ifndef NO_LOGS - trans->debug(4, "Running (non-disruptive) action: " \ + ms_dbg_a(trans, 4, "Running (non-disruptive) action: " \ + a->m_name); -#endif a->evaluate(this, trans, ruleMessage); } @@ -671,10 +641,8 @@ bool Rule::evaluate(Transaction *trans, } if (m_unconditional == true) { -#ifndef NO_LOGS - trans->debug(4, "(Rule: " + std::to_string(m_ruleId) \ + ms_dbg_a(trans, 4, "(Rule: " + std::to_string(m_ruleId) \ + ") Executing unconditional rule..."); -#endif executeActionsIndependentOfChainedRuleResult(trans, &containsBlock, ruleMessage); goto end_exec; @@ -684,10 +652,8 @@ bool Rule::evaluate(Transaction *trans, if (m_ruleId != i) { continue; } -#ifndef NO_LOGS - trans->debug(9, "Rule id: " + std::to_string(m_ruleId) + + ms_dbg_a(trans, 9, "Rule id: " + std::to_string(m_ruleId) + " was skipped due to a ruleRemoveById action..."); -#endif return true; } @@ -700,21 +666,17 @@ bool Rule::evaluate(Transaction *trans, } else { eparam = "\"" + eparam + "\""; } -#ifndef NO_LOGS - trans->debug(4, "(Rule: " + std::to_string(m_ruleId) \ + ms_dbg_a(trans, 4, "(Rule: " + std::to_string(m_ruleId) \ + ") Executing operator \"" + this->m_op->m_op \ + "\" with param " \ + eparam \ + " against " \ + variables + "."); -#endif } else { -#ifndef NO_LOGS - trans->debug(4, "(Rule: " + std::to_string(m_ruleId) \ - + ") Executing operator \"" + this->m_op->m_op \ - + " against " \ - + variables + "."); -#endif + ms_dbg_a(trans, 4, "(Rule: " + std::to_string(m_ruleId) \ + + ") Executing operator \"" + this->m_op->m_op \ + + " against " \ + + variables + "."); } getFinalVars(&vars, &exclusion, trans); @@ -795,32 +757,23 @@ bool Rule::evaluate(Transaction *trans, } if (globalRet == false) { -#ifndef NO_LOGS - trans->debug(4, "Rule returned 0."); -#endif + ms_dbg_a(trans, 4, "Rule returned 0."); cleanMatchedVars(trans); goto end_clean; } - -#ifndef NO_LOGS - trans->debug(4, "Rule returned 1."); -#endif + ms_dbg_a(trans, 4, "Rule returned 1."); if (this->m_chained == false) { goto end_exec; } if (this->m_chainedRuleChild == NULL) { -#ifndef NO_LOGS - trans->debug(4, "Rule is marked as chained but there " \ + ms_dbg_a(trans, 4, "Rule is marked as chained but there " \ "isn't a subsequent rule."); -#endif goto end_clean; } -#ifndef NO_LOGS - trans->debug(4, "Executing chained rule."); -#endif + ms_dbg_a(trans, 4, "Executing chained rule."); recursiveGlobalRet = this->m_chainedRuleChild->evaluate(trans, ruleMessage); if (recursiveGlobalRet == true) { diff --git a/src/rule_script.cc b/src/rule_script.cc index 425b20ef..03205322 100644 --- a/src/rule_script.cc +++ b/src/rule_script.cc @@ -24,9 +24,8 @@ bool RuleScript::init(std::string *err) { bool RuleScript::evaluate(Transaction *trans, std::shared_ptr ruleMessage) { -#ifndef NO_LOGS - trans->debug(4, " Executing script: " + m_name + "."); -#endif + ms_dbg_a(trans, 4, " Executing script: " + m_name + "."); + bool containsDisruptive = false; if (ruleMessage == NULL) { diff --git a/src/rules.cc b/src/rules.cc index 2231e47c..1eee60b0 100644 --- a/src/rules.cc +++ b/src/rules.cc @@ -158,18 +158,18 @@ int Rules::evaluate(int phase, Transaction *t) { std::vector rules = m_rules[phase]; - t->debug(9, "This phase consists of " \ + ms_dbg_a(t, 9, "This phase consists of " \ + std::to_string(rules.size()) + " rule(s)."); if (t->m_allowType == actions::disruptive::FromNowOnAllowType && phase != modsecurity::Phases::LoggingPhase) { - t->debug(9, "Skipping all rules evaluation on this phase as request " \ + ms_dbg_a(t, 9, "Skipping all rules evaluation on this phase as request " \ "through the utilization of an `allow' action."); return true; } if (t->m_allowType == actions::disruptive::RequestAllowType && phase <= modsecurity::Phases::RequestBodyPhase) { - t->debug(9, "Skipping all rules evaluation on this phase as request " \ + ms_dbg_a(t, 9, "Skipping all rules evaluation on this phase as request " \ "through the utilization of an `allow' action."); return true; } @@ -180,17 +180,16 @@ int Rules::evaluate(int phase, Transaction *t) { for (int i = 0; i < rules.size(); i++) { Rule *rule = rules[i]; if (t->m_marker.empty() == false) { -#ifndef NO_LOGS - t->debug(9, "Skipped rule id '" + std::to_string(rule->m_ruleId) \ + ms_dbg_a(t, 9, "Skipped rule id '" + std::to_string(rule->m_ruleId) \ + "' due to a SecMarker: " + t->m_marker); - m_secmarker_skipped++; - t->debug(9, "Rule: " + rule->m_marker); -#endif - if (rule->m_secMarker && rule->m_marker == t->m_marker) { #ifndef NO_LOGS - t->debug(4, "Out of a SecMarker after skip " \ - + std::to_string(m_secmarker_skipped) + " rules."); + m_secmarker_skipped++; #endif + ms_dbg_a(t, 9, "Rule: " + rule->m_marker); + + if (rule->m_secMarker && rule->m_marker == t->m_marker) { + ms_dbg_a(t, 4, "Out of a SecMarker after skip " \ + + std::to_string(m_secmarker_skipped) + " rules."); t->m_marker.clear(); #ifndef NO_LOGS m_secmarker_skipped = 0; @@ -198,22 +197,22 @@ int Rules::evaluate(int phase, Transaction *t) { } } else if (t->m_skip_next > 0) { t->m_skip_next--; - t->debug(9, "Skipped rule id '" + std::to_string(rule->m_ruleId) \ + ms_dbg_a(t, 9, "Skipped rule id '" + std::to_string(rule->m_ruleId) \ + "' due to a `skip' action. Still " + \ std::to_string(t->m_skip_next) + " to be skipped."); } else if (t->m_allowType != actions::disruptive::NoneAllowType) { - t->debug(9, "Skipped rule id '" + std::to_string(rule->m_ruleId) \ + ms_dbg_a(t, 9, "Skipped rule id '" + std::to_string(rule->m_ruleId) \ + "' as request trough the utilization of an `allow' action."); } else if (m_exceptions.contains(rule->m_ruleId)) { - t->debug(9, "Skipped rule id '" + std::to_string(rule->m_ruleId) \ + ms_dbg_a(t, 9, "Skipped rule id '" + std::to_string(rule->m_ruleId) \ + "'. Removed by an SecRuleRemove directive."); } else { bool remove_rule = false; if (m_exceptions.m_remove_rule_by_msg.empty() == false) { for (auto &z : m_exceptions.m_remove_rule_by_msg) { if (rule->containsMsg(z, t) == true) { - t->debug(9, "Skipped rule id '" \ + ms_dbg_a(t, 9, "Skipped rule id '" \ + std::to_string(rule->m_ruleId) \ + "'. Removed by a SecRuleRemoveByMsg directive."); remove_rule = true; @@ -228,7 +227,7 @@ int Rules::evaluate(int phase, Transaction *t) { if (m_exceptions.m_remove_rule_by_tag.empty() == false) { for (auto &z : m_exceptions.m_remove_rule_by_tag) { if (rule->containsTag(z, t) == true) { - t->debug(9, "Skipped rule id '" \ + ms_dbg_a(t, 9, "Skipped rule id '" \ + std::to_string(rule->m_ruleId) \ + "'. Removed by a SecRuleRemoveByTag directive."); remove_rule = true; @@ -242,7 +241,7 @@ int Rules::evaluate(int phase, Transaction *t) { for (auto &z : t->m_ruleRemoveByTag) { if (rule->containsTag(z, t) == true) { - t->debug(9, "Skipped rule id '" \ + ms_dbg_a(t, 9, "Skipped rule id '" \ + std::to_string(rule->m_ruleId) \ + "'. Skipped due to a ruleRemoveByTag action."); remove_rule = true; @@ -252,7 +251,7 @@ int Rules::evaluate(int phase, Transaction *t) { rule->evaluate(t, NULL); if (t->m_it.disruptive == true) { - t->debug(8, "Skipping this phase as this " \ + ms_dbg_a(t, 8, "Skipping this phase as this " \ "request was already intercepted."); break; } diff --git a/src/transaction.cc b/src/transaction.cc index 08308079..5795a8ff 100644 --- a/src/transaction.cc +++ b/src/transaction.cc @@ -138,9 +138,7 @@ Transaction::Transaction(ModSecurity *ms, Rules *rules, void *logCbData) m_variableUrlEncodedError.set("0", 0); -#ifndef NO_LOGS - this->debug(4, "Initializing transaction"); -#endif + ms_dbg(4, "Initializing transaction"); intervention::clean(&m_it); } @@ -183,9 +181,7 @@ Transaction::Transaction(ModSecurity *ms, Rules *rules, char *id, void *logCbDat m_variableUrlEncodedError.set("0", 0); -#ifndef NO_LOGS - this->debug(4, "Initializing transaction"); -#endif + ms_dbg(4, "Initializing transaction"); intervention::clean(&m_it); } @@ -262,10 +258,9 @@ int Transaction::processConnection(const char *client, int cPort, this->m_serverIpAddress = server; this->m_clientPort = cPort; this->m_serverPort = sPort; -#ifndef NO_LOGS - debug(4, "Transaction context created."); - debug(4, "Starting phase CONNECTION. (SecRules 0)"); -#endif + ms_dbg(4, "Transaction context created."); + ms_dbg(4, "Starting phase CONNECTION. (SecRules 0)"); + m_variableRemoteHost.set(m_clientIpAddress, m_variableOffset); m_variableUniqueID.set(m_id, m_variableOffset); @@ -344,10 +339,8 @@ bool Transaction::extractArguments(const std::string &orig, bool Transaction::addArgument(const std::string& orig, const std::string& key, const std::string& value, size_t offset) { -#ifndef NO_LOGS - debug(4, "Adding request argument (" + orig + "): name \"" + \ + ms_dbg(4, "Adding request argument (" + orig + "): name \"" + \ key + "\", value \"" + value + "\""); -#endif size_t k_offset = offset; offset = offset + key.size() + 1; @@ -400,9 +393,7 @@ bool Transaction::addArgument(const std::string& orig, const std::string& key, int Transaction::processURI(const char *uri, const char *method, const char *http_version) { -#ifndef NO_LOGS - debug(4, "Starting phase URI. (SecRules 0 + 1/2)"); -#endif + ms_dbg(4, "Starting phase URI. (SecRules 0 + 1/2)"); m_httpVersion = http_version; m_uri = uri; @@ -519,14 +510,10 @@ int Transaction::processURI(const char *uri, const char *method, * */ int Transaction::processRequestHeaders() { -#ifndef NO_LOGS - debug(4, "Starting phase REQUEST_HEADERS. (SecRules 1)"); -#endif + ms_dbg(4, "Starting phase REQUEST_HEADERS. (SecRules 1)"); if (getRuleEngineState() == Rules::DisabledRuleEngine) { -#ifndef NO_LOGS - debug(4, "Rule engine disabled, returning..."); -#endif + ms_dbg(4, "Rule engine disabled, returning..."); return true; } @@ -692,14 +679,10 @@ int Transaction::addRequestHeader(const unsigned char *key, size_t key_n, * */ int Transaction::processRequestBody() { -#ifndef NO_LOGS - debug(4, "Starting phase REQUEST_BODY. (SecRules 2)"); -#endif + ms_dbg(4, "Starting phase REQUEST_BODY. (SecRules 2)"); if (getRuleEngineState() == RulesProperties::DisabledRuleEngine) { -#ifndef NO_LOGS - debug(4, "Rule engine disabled, returning..."); -#endif + ms_dbg(4, "Rule engine disabled, returning..."); return true; } @@ -813,24 +796,18 @@ int Transaction::processRequestBody() { if (m_rules->m_secRequestBodyAccess == RulesProperties::FalseConfigBoolean) { if (m_requestBodyAccess != RulesProperties::TrueConfigBoolean) { -#ifndef NO_LOGS - debug(4, "Request body processing is disabled"); -#endif + ms_dbg(4, "Request body processing is disabled"); return true; } else { -#ifndef NO_LOGS - debug(4, "Request body processing is disabled, but " \ + ms_dbg(4, "Request body processing is disabled, but " \ "enabled to this transaction due to ctl:requestBodyAccess " \ "action"); -#endif } } else { if (m_requestBodyAccess == RulesProperties::FalseConfigBoolean) { -#ifndef NO_LOGS - debug(4, "Request body processing is enabled, but " \ + ms_dbg(4, "Request body processing is enabled, but " \ "disabled to this transaction due to ctl:requestBodyAccess " \ "action"); -#endif return true; } } @@ -896,9 +873,7 @@ int Transaction::requestBodyFromFile(const char *path) { std::string str; if (request_body.is_open() == false) { -#ifndef NO_LOGS - debug(3, "Failed to open request body at: " + std::string(path)); -#endif + ms_dbg(3, "Failed to open request body at: " + std::string(path)); return false; } @@ -906,9 +881,7 @@ int Transaction::requestBodyFromFile(const char *path) { try { str.reserve(request_body.tellg()); } catch (...) { -#ifndef NO_LOGS - debug(3, "Failed to allocate memory to load request body."); -#endif + ms_dbg(3, "Failed to allocate memory to load request body."); return false; } request_body.seekg(0, std::ios::beg); @@ -918,11 +891,9 @@ int Transaction::requestBodyFromFile(const char *path) { const char *buf = str.c_str(); int len = request_body.tellg(); -#ifndef NO_LOGS - debug(9, "Adding request body: " + std::to_string(len) + " bytes. " \ + ms_dbg(9, "Adding request body: " + std::to_string(len) + " bytes. " \ "Limit set to: " + std::to_string(this->m_rules->m_requestBodyLimit.m_value)); -#endif return appendRequestBody(reinterpret_cast(buf), len); } @@ -930,35 +901,28 @@ int Transaction::requestBodyFromFile(const char *path) { int Transaction::appendRequestBody(const unsigned char *buf, size_t len) { int current_size = this->m_requestBody.tellp(); -#ifndef NO_LOGS - debug(9, "Appending request body: " + std::to_string(len) + " bytes. " \ + ms_dbg(9, "Appending request body: " + std::to_string(len) + " bytes. " \ "Limit set to: " + std::to_string(this->m_rules->m_requestBodyLimit.m_value)); -#endif if (this->m_rules->m_requestBodyLimit.m_value > 0 && this->m_rules->m_requestBodyLimit.m_value < len + current_size) { m_variableInboundDataError.set("1", m_variableOffset); -#ifndef NO_LOGS - debug(5, "Request body is bigger than the maximum expected."); -#endif + ms_dbg(5, "Request body is bigger than the maximum expected."); + if (this->m_rules->m_requestBodyLimitAction == Rules::BodyLimitAction::ProcessPartialBodyLimitAction) { size_t spaceLeft = this->m_rules->m_requestBodyLimit.m_value - current_size; this->m_requestBody.write(reinterpret_cast(buf), spaceLeft); -#ifndef NO_LOGS - debug(5, "Request body limit is marked to process partial"); -#endif + ms_dbg(5, "Request body limit is marked to process partial"); return false; } else { if (this->m_rules->m_requestBodyLimitAction == Rules::BodyLimitAction::RejectBodyLimitAction) { -#ifndef NO_LOGS - debug(5, "Request body limit is marked to reject the " \ + ms_dbg(5, "Request body limit is marked to reject the " \ "request"); -#endif intervention::free(&m_it); m_it.log = strdup("Request body limit is marked to " \ "reject the request"); @@ -993,18 +957,14 @@ int Transaction::appendRequestBody(const unsigned char *buf, size_t len) { * */ int Transaction::processResponseHeaders(int code, const std::string& proto) { -#ifndef NO_LOGS - debug(4, "Starting phase RESPONSE_HEADERS. (SecRules 3)"); -#endif + ms_dbg(4, "Starting phase RESPONSE_HEADERS. (SecRules 3)"); this->m_httpCodeReturned = code; m_variableResponseStatus.set(std::to_string(code), m_variableOffset); m_variableResponseProtocol.set(proto, m_variableOffset); if (getRuleEngineState() == Rules::DisabledRuleEngine) { -#ifndef NO_LOGS - debug(4, "Rule engine disabled, returning..."); -#endif + ms_dbg(4, "Rule engine disabled, returning..."); return true; } @@ -1122,21 +1082,15 @@ int Transaction::addResponseHeader(const unsigned char *key, size_t key_n, * */ int Transaction::processResponseBody() { -#ifndef NO_LOGS - debug(4, "Starting phase RESPONSE_BODY. (SecRules 4)"); -#endif + ms_dbg(4, "Starting phase RESPONSE_BODY. (SecRules 4)"); if (getRuleEngineState() == Rules::DisabledRuleEngine) { -#ifndef NO_LOGS - debug(4, "Rule engine disabled, returning..."); -#endif + ms_dbg(4, "Rule engine disabled, returning..."); return true; } if (m_rules->m_secResponseBodyAccess != RulesProperties::TrueConfigBoolean) { -#ifndef NO_LOGS - debug(4, "Response body is disabled, returning... " + std::to_string(m_rules->m_secResponseBodyAccess)); -#endif + ms_dbg(4, "Response body is disabled, returning... " + std::to_string(m_rules->m_secResponseBodyAccess)); return true; } @@ -1145,8 +1099,7 @@ int Transaction::processResponseBody() { auto t = bi.find(m_variableResponseContentType.m_value); if (t == bi.end() && m_rules->m_responseBodyTypeToBeInspected.m_set == true) { -#ifndef NO_LOGS - debug(5, "Response Content-Type is " \ + ms_dbg(5, "Response Content-Type is " \ + m_variableResponseContentType.m_value \ + ". It is not marked to be inspected."); std::string validContetTypes(""); @@ -1154,9 +1107,8 @@ int Transaction::processResponseBody() { i != bi.end(); i++) { validContetTypes.append(*i + " "); } - debug(8, "Content-Type(s) marked to be inspected: " \ + ms_dbg(8, "Content-Type(s) marked to be inspected: " \ + validContetTypes); -#endif return true; } if (m_variableOutboundDataError.m_value.empty() == true) { @@ -1197,44 +1149,34 @@ int Transaction::appendResponseBody(const unsigned char *buf, size_t len) { this->m_rules->m_responseBodyTypeToBeInspected.m_value; auto t = bi.find(m_variableResponseContentType.m_value); if (t == bi.end() && bi.empty() == false) { -#ifndef NO_LOGS - debug(4, "Not appending response body. " \ + ms_dbg(4, "Not appending response body. " \ "Response Content-Type is " \ + m_variableResponseContentType.m_value \ + ". It is not marked to be inspected."); -#endif return true; } -#ifndef NO_LOGS - debug(9, "Appending response body: " + std::to_string(len + current_size) + ms_dbg(9, "Appending response body: " + std::to_string(len + current_size) + " bytes. Limit set to: " + std::to_string(this->m_rules->m_responseBodyLimit.m_value)); -#endif if (this->m_rules->m_responseBodyLimit.m_value > 0 && this->m_rules->m_responseBodyLimit.m_value < len + current_size) { m_variableOutboundDataError.set("1", m_variableOffset); -#ifndef NO_LOGS - debug(5, "Response body is bigger than the maximum expected."); -#endif + ms_dbg(5, "Response body is bigger than the maximum expected."); if (this->m_rules->m_responseBodyLimitAction == Rules::BodyLimitAction::ProcessPartialBodyLimitAction) { size_t spaceLeft = this->m_rules->m_responseBodyLimit.m_value \ - current_size; this->m_responseBody.write(reinterpret_cast(buf), spaceLeft); -#ifndef NO_LOGS - debug(5, "Response body limit is marked to process partial"); -#endif + ms_dbg(5, "Response body limit is marked to process partial"); return false; } else { if (this->m_rules->m_responseBodyLimitAction == Rules::BodyLimitAction::RejectBodyLimitAction) { -#ifndef NO_LOGS - debug(5, "Response body limit is marked to reject the " \ + ms_dbg(5, "Response body limit is marked to reject the " \ "request"); -#endif intervention::free(&m_it); m_it.log = strdup("Response body limit is marked to reject " \ "the request"); @@ -1323,14 +1265,10 @@ size_t Transaction::getRequestBodyLength() { * */ int Transaction::processLogging() { -#ifndef NO_LOGS - debug(4, "Starting phase LOGGING. (SecRules 5)"); -#endif + ms_dbg(4, "Starting phase LOGGING. (SecRules 5)"); if (getRuleEngineState() == Rules::DisabledRuleEngine) { -#ifndef NO_LOGS - debug(4, "Rule engine disabled, returning..."); -#endif + ms_dbg(4, "Rule engine disabled, returning..."); return true; } @@ -1339,20 +1277,14 @@ int Transaction::processLogging() { /* If relevant, save this transaction information at the audit_logs */ if (m_rules != NULL && m_rules->m_auditLog != NULL) { int parts = this->m_rules->m_auditLog->getParts(); -#ifndef NO_LOGS - debug(8, "Checking if this request is suitable to be " \ + ms_dbg(8, "Checking if this request is suitable to be " \ "saved as an audit log."); -#endif if (this->m_auditLogModifier.size() > 0) { -#ifndef NO_LOGS - debug(4, "There was an audit log modifier for this transaction."); -#endif + ms_dbg(4, "There was an audit log modifier for this transaction."); std::list>::iterator it; -#ifndef NO_LOGS - debug(7, "AuditLog parts before modification(s): " + + ms_dbg(7, "AuditLog parts before modification(s): " + std::to_string(parts) + "."); -#endif for (it = m_auditLogModifier.begin(); it != m_auditLogModifier.end(); ++it) { std::pair p = *it; @@ -1365,16 +1297,12 @@ int Transaction::processLogging() { } } } -#ifndef NO_LOGS - debug(8, "Checking if this request is relevant to be " \ + ms_dbg(8, "Checking if this request is relevant to be " \ "part of the audit logs."); -#endif bool saved = this->m_rules->m_auditLog->saveIfRelevant(this, parts); if (saved) { -#ifndef NO_LOGS - debug(8, "Request was relevant to be saved. Parts: " + + ms_dbg(8, "Request was relevant to be saved. Parts: " + std::to_string(parts)); -#endif } } diff --git a/src/variables/xml.cc b/src/variables/xml.cc index 4c4f430f..7fe47157 100644 --- a/src/variables/xml.cc +++ b/src/variables/xml.cc @@ -82,42 +82,32 @@ void XML::evaluate(Transaction *t, xpathExpr = (const xmlChar*)param.c_str(); xpathCtx = xmlXPathNewContext(t->m_xml->m_data.doc); if (xpathCtx == NULL) { -#ifndef NO_LOGS - t->debug(1, "XML: Unable to create new XPath context. : "); -#endif + ms_dbg_a(t, 1, "XML: Unable to create new XPath context. : "); return; } if (rule == NULL) { -#ifndef NO_LOGS - t->debug(2, "XML: Can't look for xmlns, internal error."); -#endif + ms_dbg_a(t, 2, "XML: Can't look for xmlns, internal error."); } else { std::vector acts = rule->getActionsByName("xmlns", t); for (auto &x : acts) { actions::XmlNS *z = (actions::XmlNS *)x; if (xmlXPathRegisterNs(xpathCtx, (const xmlChar*)z->m_scope.c_str(), (const xmlChar*)z->m_href.c_str()) != 0) { -#ifndef NO_LOGS - t->debug(1, "Failed to register XML namespace href \"" + \ + ms_dbg_a(t, 1, "Failed to register XML namespace href \"" + \ z->m_href + "\" prefix \"" + z->m_scope + "\"."); -#endif return; } -#ifndef NO_LOGS - t->debug(4, "Registered XML namespace href \"" + z->m_href + \ + ms_dbg_a(t, 4, "Registered XML namespace href \"" + z->m_href + \ "\" prefix \"" + z->m_scope + "\""); -#endif } } /* Initialise XPath expression. */ xpathObj = xmlXPathEvalExpression(xpathExpr, xpathCtx); if (xpathObj == NULL) { -#ifndef NO_LOGS - t->debug(1, "XML: Unable to evaluate xpath expression."); -#endif + ms_dbg_a(t, 1, "XML: Unable to evaluate xpath expression."); xmlXPathFreeContext(xpathCtx); return; } diff --git a/test/regression/regression.cc b/test/regression/regression.cc index f9f1aed2..7a59bf57 100644 --- a/test/regression/regression.cc +++ b/test/regression/regression.cc @@ -169,6 +169,7 @@ void perform_unit_test(ModSecurityTest *test, continue; } + modsec_rules->load("SecDebugLogLevel 9"); if (modsec_rules->load(t->rules.c_str(), filename) < 0) { /* Parser error */ if (t->parser_error.empty() == true) { diff --git a/test/test-cases/regression/collection-tx.json b/test/test-cases/regression/collection-tx.json index 90786996..07099405 100644 --- a/test/test-cases/regression/collection-tx.json +++ b/test/test-cases/regression/collection-tx.json @@ -272,5 +272,66 @@ "SecRule REQUEST_HEADERS \"@contains PHPSESSID\" \"id:3,t:lowercase,t:none,setvar:TX.something=-5\"", "SecRule TX \"@contains to_test\" \"id:4,t:lowercase,t:none\"" ] + }, + { + "enabled":1, + "version_min":300000, + "version_max":0, + "title":"Testing collection :: TX (5/n)", + "client":{ + "ip":"200.249.12.31", + "port":2313 + }, + "server":{ + "ip":"200.249.12.31", + "port":80 + }, + "request":{ + "headers":{ + "User-Agent":"Mozilla\/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko\/20091102 Firefox\/3.5.5 (.NET CLR 3.5.30729)", + "Accept":"text\/html,application\/xhtml+xml,application\/xml;q=0.9,*\/*;q=0.8", + "Accept-Language":"en-us,en;q=0.5", + "Accept-Encoding":"gzip,deflate", + "Accept-Charset":"ISO-8859-1,utf-8;q=0.7,*;q=0.7", + "Keep-Alive":"300", + "Connection":"keep-alive", + "Cookie":"PHPSESSID=rAAAAAAA2t5uvjq435r4q7ib3vtdjq120 - cookie I", + "Cookie2":"PHPSESSID=rAAAAAAA2t5uvjq435r4q7ib3vtdjq120 - cookie II", + "Pragma":"no-cache", + "Cache-Control":"no-cache" + }, + "uri":"\/test.pl?param1= test ¶m2=test2", + "method":"GET", + "http_version":1.1, + "body":"" + }, + "response":{ + "headers":{ + "Content-Type":"text\/xml; charset=utf-8\n\r", + "Content-Length":"length\n\r" + }, + "body":[ + "\n\r", + "\n\r", + " \n\r", + " \n\r", + " string<\/EnlightenResult>\n\r", + " <\/EnlightenResponse>\n\r", + " <\/soap:Body>\n\r", + "<\/soap:Envelope>\n\r" + ] + }, + "expected":{ + "audit_log":"", + "debug_log":"Target value: \"40\" \\(Variable: TX:anomaly_score\\)", + "error_log":"" + }, + "rules":[ + "SecRuleEngine On", + "SecRule REQUEST_HEADERS:Cookie \"@contains PHPSESSID\" \"id:1,setvar:tx.critical_anomaly_score=5\"", + "SecRule REQUEST_HEADERS:Cookie \"@contains PHPSESSID\" \"id:2,setvar:tx.anomaly_score=10\"", + "SecRule REQUEST_HEADERS:Cookie|REQUEST_HEADERS:Cookie2 \"@contains ookie\" \"id:4,t:lowercase,t:removewhitespace,multimatch,setvar:tx.anomaly_score=+%{tx.critical_anomaly_score}\"", + "SecRule TX \"@contains to_test\" \"id:100\"" + ] } ]