Skip to content

Commit

Permalink
Revert "Treating ARGS_NAMES as an array instead of scalar"
Browse files Browse the repository at this point in the history
This reverts commit 1d3c4c6.
  • Loading branch information
Felipe Zimmerle committed Aug 24, 2017
1 parent 43e3ff9 commit 9069a45
Show file tree
Hide file tree
Showing 18 changed files with 3,748 additions and 3,085 deletions.
14 changes: 7 additions & 7 deletions headers/modsecurity/transaction.h
Expand Up @@ -95,8 +95,8 @@ class TransactionAnchoredVariables {
public:
explicit TransactionAnchoredVariables(Transaction *t)
: m_variableArgsNames(t, "ARGS_NAMES"),
m_variableArgGetNames(t, "ARGS_GET_NAMES"),
m_variableArgPostNames(t, "ARGS_POST_NAMES"),
m_variableArgsGetNames(t, "ARGS_GET_NAMES"),
m_variableArgsPostNames(t, "ARGS_POST_NAMES"),
m_variableRequestHeadersNames(t, "REQUEST_HEADERS_NAMES"),
m_variableResponseContentType(t, "RESPONSE_CONTENT_TYPE"),
m_variableResponseHeadersNames(t, "RESPONSE_HEADERS_NAMES"),
Expand Down Expand Up @@ -172,11 +172,12 @@ class TransactionAnchoredVariables {
m_variableOffset(0)
{ }

AnchoredVariable m_variableArgGetNames;
AnchoredVariable m_variableArgPostNames;
AnchoredVariable m_variableRequestHeadersNames;
AnchoredSetVariable m_variableArgsNames;
AnchoredSetVariable m_variableArgsGetNames;
AnchoredSetVariable m_variableArgsPostNames;
AnchoredSetVariable m_variableRequestHeadersNames;
AnchoredVariable m_variableResponseContentType;
AnchoredVariable m_variableResponseHeadersNames;
AnchoredSetVariable m_variableResponseHeadersNames;
AnchoredVariable m_variableARGScombinedSize;
AnchoredVariable m_variableAuthType;
AnchoredVariable m_variableFilesCombinedSize;
Expand Down Expand Up @@ -226,7 +227,6 @@ class TransactionAnchoredVariables {
AnchoredVariable m_variableUrlEncodedError;
AnchoredVariable m_variableUserID;

AnchoredSetVariable m_variableArgsNames;
AnchoredSetVariable m_variableArgs;
AnchoredSetVariable m_variableArgsGet;
AnchoredSetVariable m_variableArgsPost;
Expand Down
28 changes: 14 additions & 14 deletions src/macro_expansion.cc
Expand Up @@ -73,21 +73,9 @@ std::string MacroExpansion::expand(const std::string& input,
collection = variable.find(":");
}
if (collection == std::string::npos) {
if (compareStrNoCase(variable, "ARGS_GET_NAMES")) {
variableValue = transaction->m_variableArgGetNames.resolveFirst();
}
else if (compareStrNoCase(variable, "ARGS_POST_NAMES")) {
variableValue = transaction->m_variableArgPostNames.resolveFirst();
}
else if (compareStrNoCase(variable, "REQUEST_HEADERS_NAMES")) {
variableValue = transaction->m_variableRequestHeadersNames.resolveFirst();
}
else if (compareStrNoCase(variable, "RESPONSE_CONTENT_TYPE")) {
if (compareStrNoCase(variable, "RESPONSE_CONTENT_TYPE")) {
variableValue = transaction->m_variableResponseContentType.resolveFirst();
}
else if (compareStrNoCase(variable, "RESPONSE_HEADERS_NAMES")) {
variableValue = transaction->m_variableResponseHeadersNames.resolveFirst();
}
else if (compareStrNoCase(variable, "ARGS_COMBINED_SIZE")) {
variableValue = transaction->m_variableARGScombinedSize.resolveFirst();
}
Expand Down Expand Up @@ -242,9 +230,15 @@ std::string MacroExpansion::expand(const std::string& input,
if (compareStrNoCase(col, "ARGS")) {
variableValue = transaction->m_variableArgs.resolveFirst(var);
}
if (compareStrNoCase(variable, "ARGS_NAMES")) {
else if (compareStrNoCase(variable, "ARGS_NAMES")) {
variableValue = transaction->m_variableArgsNames.resolveFirst(var);
}
else if (compareStrNoCase(variable, "ARGS_GET_NAMES")) {
variableValue = transaction->m_variableArgsGetNames.resolveFirst(var);
}
else if (compareStrNoCase(variable, "ARGS_POST_NAMES")) {
variableValue = transaction->m_variableArgsPostNames.resolveFirst(var);
}
else if (compareStrNoCase(col, "RULE")) {
variableValue = transaction->m_variableRule.resolveFirst(var);
}
Expand Down Expand Up @@ -284,9 +278,15 @@ std::string MacroExpansion::expand(const std::string& input,
else if (compareStrNoCase(col, "REQUEST_HEADERS")) {
variableValue = transaction->m_variableRequestHeaders.resolveFirst(var);
}
else if (compareStrNoCase(variable, "REQUEST_HEADERS_NAMES")) {
variableValue = transaction->m_variableRequestHeadersNames.resolveFirst(var);
}
else if (compareStrNoCase(col, "RESPONSE_HEADERS")) {
variableValue = transaction->m_variableResponseHeaders.resolveFirst(var);
}
else if (compareStrNoCase(variable, "RESPONSE_HEADERS_NAMES")) {
variableValue = transaction->m_variableResponseHeadersNames.resolveFirst(var);
}
else if (compareStrNoCase(col, "GEO")) {
variableValue = transaction->m_variableGeo.resolveFirst(var);
}
Expand Down

0 comments on commit 9069a45

Please sign in to comment.