mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 19:47:47 +03:00
fixed compilation error with disable_debug_log flag
This commit is contained in:
committed by
Felipe Zimmerle
parent
81e1cdced3
commit
e9f3312ea9
@@ -153,7 +153,9 @@ int Lua::run(Transaction *t) {
|
||||
break;
|
||||
}
|
||||
e.append(lua_tostring(L, -1));
|
||||
#ifndef NO_LOGS
|
||||
t->debug(2, e);
|
||||
#endif
|
||||
ret = false;
|
||||
goto err;
|
||||
}
|
||||
@@ -167,7 +169,9 @@ int Lua::run(Transaction *t) {
|
||||
e.append(" - ");
|
||||
e.append(luaerr);
|
||||
}
|
||||
#ifndef NO_LOGS
|
||||
t->debug(2, e);
|
||||
#endif
|
||||
ret = false;
|
||||
goto err;
|
||||
}
|
||||
@@ -183,7 +187,9 @@ int Lua::run(Transaction *t) {
|
||||
e.append(" - ");
|
||||
e.append(luaerr);
|
||||
}
|
||||
#ifndef NO_LOGS
|
||||
t->debug(2, e);
|
||||
#endif
|
||||
ret = false;
|
||||
goto err;
|
||||
}
|
||||
@@ -192,8 +198,9 @@ int Lua::run(Transaction *t) {
|
||||
if (a != NULL) {
|
||||
luaRet.assign(a);
|
||||
}
|
||||
|
||||
#ifndef NO_LOGS
|
||||
t->debug(9, "Returning from lua script: " + luaRet);
|
||||
#endif
|
||||
|
||||
if (luaRet.size() == 0) {
|
||||
ret = false;
|
||||
@@ -206,7 +213,9 @@ err:
|
||||
|
||||
return ret;
|
||||
#else
|
||||
#ifndef NO_LOGS
|
||||
t->debug(9, "Lua support was not enabled.");
|
||||
#endif
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
@@ -228,7 +237,9 @@ int Lua::log(lua_State *L) {
|
||||
|
||||
/* Log message. */
|
||||
if (t != NULL) {
|
||||
#ifndef NO_LOGS
|
||||
t->debug(level, text);
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -320,7 +331,9 @@ 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
|
||||
return -1;
|
||||
}
|
||||
var_value = luaL_checkstring(L, 2);
|
||||
@@ -341,8 +354,10 @@ 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" \
|
||||
" - ie m.setvar(tx.myvar,mydata)");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -380,8 +395,10 @@ 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: " \
|
||||
+ std::string(name));
|
||||
#endif
|
||||
}
|
||||
delete tfn;
|
||||
}
|
||||
@@ -402,17 +419,19 @@ 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: " \
|
||||
+ std::string(name));
|
||||
#endif
|
||||
}
|
||||
return newVar;
|
||||
}
|
||||
|
||||
#ifndef NO_LOGS
|
||||
t->debug(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
|
||||
|
Reference in New Issue
Block a user