-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Update to seclang-scanner changes introduced by Windows support #3146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to seclang-scanner changes introduced by Windows support #3146
Conversation
- 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 owasp-modsecurity#3132 would probably be overwritten when the parser is updated.
For the sake of reference:
In order to determine whether the scanner needs to be interactive, it calls the function |
Oh gosh, I forgot to mention that - because I realized... sorry. Yes, seclang-parser.cc and seclang-scanner.cc files are generated. Those depend not just on the content (tokens and grammar) but the Bison's version too. So you should forget to touch them, because every modifications will be overwritten next time when someone adds a new configure directive or any language component.
Yes, this is how Flex work - but this is the expected behavior on every other systems, not just on Windows.
Please remove the
Right, thanks. |
Yes, I saw
That's ok, the version I included in this PR is the one generated with the updated version of |
- build/win32/* files from Windows builds, other files from Unix builds
|
okay,
Now I see, thank you. Approved, merging now. Many thanks for your contribution. |
While testing the builds with parser generation in PR #3144 I found out that the changes introduced to seclang-scanner.cc in commit a488568 would likely be overwritten next time an update to the parser is introduced.
This cannot be avoided by introducing the required change (an #ifdef not to include unistd.h in the Windows build as it's not available in the MSVC C++ compiler, and include io.h instead) in seclang-scanner.ll because the code is always injected by Flex itself:
As suggested by the comment, this PR introduces the option to disable including
unistd.h
, as it's not required by the parser usage in libModSecurity. The options added to seclang-scanner.cc are:nounistd never-interactive
(the first requires the second to be also set for the generated code to compile).This PR also includes two minor additional changes related to Windows support.