components/apache2-modules/mod_security2/patches/fix_lua.patch
changeset 1447 70f310fd9b7e
parent 1446 9b1d5a04b4f7
child 1448 3288b0639de6
--- a/components/apache2-modules/mod_security2/patches/fix_lua.patch	Mon Aug 19 23:01:39 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-https://github.com/SpiderLabs/ModSecurity/commit/452177c437cdefeb6e8b773b5865af356a1c9e2d.patch
-
-From 452177c437cdefeb6e8b773b5865af356a1c9e2d Mon Sep 17 00:00:00 2001
-From: Breno Silva <[email protected]>
-Date: Wed, 30 Jan 2013 22:04:21 -0400
-Subject: [PATCH] ModSecurity: fixed compiling with lua 5.2
-
----
- apache2/mod_security2.c |    4 ++++
- apache2/msc_lua.c       |   17 +++++++++++++++++
- 2 files changed, 21 insertions(+)
-
-diff --git a/apache2/mod_security2.c b/apache2/mod_security2.c
-index 6b41088..849ca9d 100644
---- a/apache2/mod_security2.c
-+++ b/apache2/mod_security2.c
-@@ -440,7 +440,11 @@ static modsec_rec *create_tx_context(request_rec *r) {
- 
- #if defined(WITH_LUA)
-     #ifdef CACHE_LUA
-+#if LUA_VERSION_NUM > 501
-+    msr->L = luaL_newstate();
-+#else
-     msr->L = lua_open();
-+#endif
-     luaL_openlibs(msr->L);
-     #endif
- #endif
-diff --git a/apache2/msc_lua.c b/apache2/msc_lua.c
-index 4abf7e5..6450e77 100644
---- a/apache2/msc_lua.c
-+++ b/apache2/msc_lua.c
-@@ -94,7 +94,11 @@ char *lua_compile(msc_script **script, const char *filename, apr_pool_t *pool) {
-     msc_lua_dumpw_t dump;
- 
-     /* Initialise state. */
-+#if LUA_VERSION_NUM > 501
-+    L = luaL_newstate();
-+#else
-     L = lua_open();
-+#endif
-     luaL_openlibs(L);
- 
-     /* Find script. */
-@@ -158,7 +162,11 @@ static apr_array_header_t *resolve_tfns(lua_State *L, int idx, modsec_rec *msr,
-     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? */
-+#if LUA_VERSION_NUM > 501
-+        int i, n = lua_rawlen(L, idx);
-+#else
-         int i, n = lua_objlen(L, idx);
-+#endif
- 
-         for(i = 1; i <= n; i++) {
-             lua_rawgeti(L, idx, i);
-@@ -415,7 +423,11 @@ int lua_execute(msc_script *script, char *param, modsec_rec *msr, msre_rule *rul
-         lua_pop(L, rc);
- #else
-     /* Create new state. */
-+#if LUA_VERSION_NUM > 501
-+    L = luaL_newstate();
-+#else
-     L = lua_open();
-+#endif
-     luaL_openlibs(L);
- #endif
- 
-@@ -433,7 +445,12 @@ int lua_execute(msc_script *script, char *param, modsec_rec *msr, msre_rule *rul
-     }
- 
-     /* Register functions. */
-+#if LUA_VERSION_NUM > 501
-+    luaL_setfuncs(L,mylib,0);
-+    lua_setglobal(L,"m");
-+#else
-     luaL_register(L, "m", mylib);
-+#endif
- 
-     rc = lua_restore(L, script);
-     if (rc) {
--- 
-1.7.10
-