From 2c488386c4fc393ff1decf8b824f451d18fff12a Mon Sep 17 00:00:00 2001 From: Eduardo Arias Date: Sun, 19 May 2024 16:38:03 +0000 Subject: [PATCH 1/4] Add options nounistd & never-interactive to seclang-scanner.ll - The parser is not used interactively so we can avoid including unistd.h, which is not available on Windows MSVC C++ compiler. - The #ifdef WIN32 introduced in PR #3132 would probably be overwritten when the parser is updated. --- src/parser/seclang-scanner.cc | 13 +++++-------- src/parser/seclang-scanner.ll | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/parser/seclang-scanner.cc b/src/parser/seclang-scanner.cc index 92afab762b..4e55e00bf0 100644 --- a/src/parser/seclang-scanner.cc +++ b/src/parser/seclang-scanner.cc @@ -4900,13 +4900,14 @@ static std::stack YY_PREVIOUS_STATE; // The location of the current token. #line 4902 "seclang-scanner.cc" #define YY_NO_INPUT 1 +#define YY_NO_UNISTD_H 1 #line 494 "seclang-scanner.ll" // Code run each time a pattern is matched. # define YY_USER_ACTION driver.loc.back()->columns (yyleng); -#line 4909 "seclang-scanner.cc" #line 4910 "seclang-scanner.cc" +#line 4911 "seclang-scanner.cc" #define INITIAL 0 #define EXPECTING_ACTION_PREDICATE_VARIABLE 1 @@ -4952,11 +4953,7 @@ static std::stack YY_PREVIOUS_STATE; * The user has a chance to override it with an option. */ /* %if-c-only */ -#ifndef WIN32 #include -#else -#include -#endif /* %endif */ /* %if-c++-only */ /* %endif */ @@ -5232,7 +5229,7 @@ YY_DECL // Code run each time yylex is called. driver.loc.back()->step(); -#line 5232 "seclang-scanner.cc" +#line 5233 "seclang-scanner.cc" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { @@ -8338,7 +8335,7 @@ YY_RULE_SETUP #line 1340 "seclang-scanner.ll" ECHO; YY_BREAK -#line 8338 "seclang-scanner.cc" +#line 8339 "seclang-scanner.cc" case YY_END_OF_BUFFER: { @@ -8960,7 +8957,7 @@ static void yy_load_buffer_state (void) /* %if-c-only */ - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + b->yy_is_interactive = 0; /* %endif */ /* %if-c++-only */ diff --git a/src/parser/seclang-scanner.ll b/src/parser/seclang-scanner.ll index c6756d6ff8..c1a04a65d4 100755 --- a/src/parser/seclang-scanner.ll +++ b/src/parser/seclang-scanner.ll @@ -73,7 +73,7 @@ static std::stack YY_PREVIOUS_STATE; // The location of the current token. %} -%option noyywrap nounput batch debug noinput +%option noyywrap nounput batch debug noinput nounistd never-interactive From fbaf052a0af52f54b126c2f007d9a2efa55cc43c Mon Sep 17 00:00:00 2001 From: Eduardo Arias Date: Sun, 19 May 2024 21:10:25 +0000 Subject: [PATCH 2/4] Update Windows build information after PR #3132 --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index d41e19d22f..99a664a7ae 100644 --- a/README.md +++ b/README.md @@ -71,8 +71,7 @@ Details on distribution specific builds can be found in our Wiki: ### Windows -Windows build is not ready yet. - +Windows build information can be found [here](build/win32/README.md). ## Dependencies From 9e44964dc713f3014c010dc4929dd25376636db6 Mon Sep 17 00:00:00 2001 From: Eduardo Arias Date: Sun, 19 May 2024 21:12:34 +0000 Subject: [PATCH 3/4] Use SRC_DIR argument --- build/win32/docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/win32/docker/Dockerfile b/build/win32/docker/Dockerfile index 1dc6048275..4a033f9d3b 100644 --- a/build/win32/docker/Dockerfile +++ b/build/win32/docker/Dockerfile @@ -56,7 +56,7 @@ WORKDIR C:\ RUN cmd.exe /C md %SRC_DIR% # libModSecurity -WORKDIR C:\src +WORKDIR ${SCR_DIR} ARG MOD_SECURITY_TAG=v3/master RUN git clone -c advice.detachedHead=false --depth 1 --branch %MOD_SECURITY_TAG% https://github.com/owasp-modsecurity/ModSecurity.git From 5a543d9c0b99c86aca408b68a696f2627b3491ba Mon Sep 17 00:00:00 2001 From: Eduardo Arias Date: Thu, 23 May 2024 01:38:15 +0000 Subject: [PATCH 4/4] Updated .gitignore to ignore files generated in builds - build/win32/* files from Windows builds, other files from Unix builds --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 390c0e6066..be0de1557c 100644 --- a/.gitignore +++ b/.gitignore @@ -11,13 +11,18 @@ build/ltoptions.m4 build/ltsugar.m4 build/ltversion.m4 build/lt~obsolete.m4 +build/win32/build +build/win32/CMakeUserPresets.json compile config.guess config.log config.status config.sub +config.h.in~ configure +configure~ depcomp +modsecurity.pc .deps .libs .dirstamp