Revert any lua change

This commit is contained in:
brenosilva
2012-02-08 18:11:45 +00:00
parent 24ac0c4a9f
commit 4bebeb6dd7
2 changed files with 11 additions and 19 deletions

View File

@@ -108,7 +108,9 @@ char *lua_compile(msc_script **script, const char *filename, apr_pool_t *pool) {
(*script) = apr_pcalloc(pool, sizeof(msc_script));
(*script)->name = filename;
(*script)->parts = dump.parts;
(*script)->Lstate = L;
/* Destroy state. */
lua_close(L);
return NULL;
}
@@ -390,8 +392,8 @@ static const struct luaL_Reg mylib[] = {
*/
int lua_execute(msc_script *script, char *param, modsec_rec *msr, msre_rule *rule, char **error_msg) {
apr_time_t time_before;
lua_State *L = script->Lstate;
int rc, lvm;
lua_State *L = NULL;
int rc;
if (error_msg == NULL) return -1;
*error_msg = NULL;
@@ -402,16 +404,10 @@ int lua_execute(msc_script *script, char *param, modsec_rec *msr, msre_rule *rul
time_before = apr_time_now();
if (L == NULL) {
/* Create new state. */
L = lua_open();
luaL_openlibs(L);
lvm = 1;
if (L == NULL) {
*error_msg = apr_psprintf(msr->mp, "Lua: Failed to create Lua state");
return -1;
}
}
/* Create new state. */
L = lua_open();
luaL_openlibs(L);
/* Associate msr with the state. */
lua_pushlightuserdata(L, (void *)msr);
@@ -454,12 +450,9 @@ int lua_execute(msc_script *script, char *param, modsec_rec *msr, msre_rule *rul
*error_msg = apr_pstrdup(msr->mp, *error_msg);
}
lua_pop(L, 1);
/* Destroy state. */
if(lvm) {
lua_close(L);
}
lua_pop(L, 1);
lua_close(L);
/* Returns status code to caller. */
if (msr->txcfg->debuglog_level >= 8) {