Fix build fail with lua 5.4.3

(cherry picked from commit 3dde482aacee13b1f3fcfb3f30f1fe74a633dc0a)
This commit is contained in:
lyn1001 2022-01-07 09:55:25 +08:00 committed by openeuler-sync-bot
parent c56d577933
commit b024f4b398
2 changed files with 36 additions and 1 deletions

View File

@ -7,7 +7,7 @@
Name: mod_security Name: mod_security
Version: 2.9.5 Version: 2.9.5
Release: 1 Release: 2
Summary: Security module for the Apache HTTP Server Summary: Security module for the Apache HTTP Server
License: ASL 2.0 License: ASL 2.0
URL: http://www.modsecurity.org/ URL: http://www.modsecurity.org/
@ -15,6 +15,7 @@ Source: https://github.com/SpiderLabs/ModSecurity/releases/download/v%{version}/
Source1: mod_security.conf Source1: mod_security.conf
Source2: 10-mod_security.conf Source2: 10-mod_security.conf
Source3: modsecurity_localrules.conf Source3: modsecurity_localrules.conf
Patch0000: modsecurity-2.9.5-lua-54.patch
Requires: httpd httpd-mmn = %{_httpd_mmn} Requires: httpd httpd-mmn = %{_httpd_mmn}
BuildRequires: gcc make perl-generators httpd-devel yajl yajl-devel BuildRequires: gcc make perl-generators httpd-devel yajl yajl-devel
@ -97,6 +98,9 @@ install -m0755 mlogc/mlogc-batch-load.pl %{buildroot}%{_bindir}/mlogc-batch-load
%endif %endif
%changelog %changelog
* Fri Jan 7 liyanan <liyanan32@huawei.com> - 2.9.5-2
- Fix build fail with lua 5.4.3
* Tue Dec 14 2021 yaoxin <yaoxin30@huawei.com> - 2.9.5-1 * Tue Dec 14 2021 yaoxin <yaoxin30@huawei.com> - 2.9.5-1
- Upgrade mod_security to 2.9.5 for fix CVE-2021-42717 - Upgrade mod_security to 2.9.5 for fix CVE-2021-42717

View File

@ -0,0 +1,31 @@
diff -ru modsecurity-2.9.5/apache2/msc_lua.c modsecurity-2.9.5-lua-patch/apache2/msc_lua.c
--- modsecurity-2.9.5/apache2/msc_lua.c 2018-12-04 18:49:37.000000000 +0000
+++ modsecurity-2.9.5-lua-patch/apache2/msc_lua.c 2020-08-08 16:55:14.936045777 +0000
@@ -429,12 +429,12 @@
#else
/* Create new state. */
-#if LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503 || LUA_VERSION_NUM == 501
+#if LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503 || LUA_VERSION_NUM == 501 || LUA_VERSION_NUM == 504
L = luaL_newstate();
#elif LUA_VERSION_NUM == 500
L = lua_open();
#else
-#error We are only tested under Lua 5.0, 5.1, 5.2, or 5.3.
+#error We are only tested under Lua 5.0, 5.1, 5.2, 5.3 or 5.4.
#endif
luaL_openlibs(L);
@@ -459,10 +459,10 @@
/* Register functions. */
#if LUA_VERSION_NUM == 500 || LUA_VERSION_NUM == 501
luaL_register(L, "m", mylib);
-#elif LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503
+#elif LUA_VERSION_NUM == 502 || LUA_VERSION_NUM == 503 || LUA_VERSION_NUM == 504
luaL_setfuncs(L, mylib, 0);
#else
-#error We are only tested under Lua 5.0, 5.1, 5.2, or 5.3.
+#error We are only tested under Lua 5.0, 5.1, 5.2, 5.3 or 5.4.
#endif
lua_setglobal(L, "m");