From 935677a780f8e9132b6ed395d972635b72a87382 Mon Sep 17 00:00:00 2001 From: brectanus Date: Mon, 11 Feb 2008 21:57:21 +0000 Subject: [PATCH] Do not add alert message when a transformation is not specified in a Lua rule. --- apache2/msc_lua.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apache2/msc_lua.c b/apache2/msc_lua.c index b4f6a937..4d6478f6 100644 --- a/apache2/msc_lua.c +++ b/apache2/msc_lua.c @@ -140,7 +140,10 @@ static apr_array_header_t *resolve_tfns(lua_State *L, int idx, modsec_rec *msr, tfn_arr = apr_array_make(mp, 25, sizeof(msre_tfn_metadata *)); if (tfn_arr == NULL) return NULL; - if (lua_istable(L, idx)) { /* Is the second parameter an array? */ + /* ENH: Why is this userdata and not none/nil when parameter not given? */ + if (lua_isuserdata(L, idx) || lua_isnoneornil(L, idx)) { /* No second parameter */ + return tfn_arr; + } else if (lua_istable(L, idx)) { /* Is the second parameter an array? */ int i, n = lua_objlen(L, idx); for(i = 1; i <= n; i++) { @@ -176,7 +179,7 @@ static apr_array_header_t *resolve_tfns(lua_State *L, int idx, modsec_rec *msr, } } } else { - msr_log(msr, 1, "SecRuleScript: Transformation parameter must be a transformation name or array of transformation names."); + msr_log(msr, 1, "SecRuleScript: Transformation parameter must be a transformation name or array of transformation names, but found \"%s\" (type %d).", lua_typename(L, idx), lua_type(L, idx)); return NULL; }