Refactoring: Makes transformations to work with new execute signature

This commit is contained in:
Felipe Zimmerle
2019-02-26 15:39:27 -03:00
parent 44c63d1048
commit 68f85628dd
93 changed files with 913 additions and 715 deletions

View File

@@ -439,7 +439,11 @@ std::string Lua::applyTransformations(lua_State *L, Transaction *t,
"t:" + std::string(name));
// FIXME: transformation is not yet returning null.
if (tfn) {
newVar = tfn->execute(newVar, t);
ModSecStackString in;
ModSecStackString out;
in.assign(newVar.c_str(), newVar.size());
tfn->execute(t, in, out);
newVar.assign(out.c_str(), out.size());
} else {
ms_dbg_a(t, 1,
"SecRuleScript: Invalid transformation function: " \
@@ -461,7 +465,11 @@ std::string Lua::applyTransformations(lua_State *L, Transaction *t,
// FIXME: transformation is not yet returning null.
if (tfn) {
newVar = tfn->execute(newVar, t);
ModSecStackString in;
ModSecStackString out;
in.assign(newVar.c_str(), newVar.size());
tfn->execute(t, in, out);
newVar.assign(out.c_str(), out.size());
delete tfn;
} else {
ms_dbg_a(t, 1, "SecRuleScript: Invalid transformation function: " \