owasp-modsecurity / owasp-modsecurity/ModSecurity-nginx
Needs to include stdio.h in nginx/auto/feature for this to work
Nobody has claimed this yet.
- Dominant language
- Perl
- Stars
- 1.9k
- Forks
- 312
- PR merge metrics
- No merged PRs in 30d
Description
nginx src version: 1.20.2
When I was trying to compile the nginx connector module, nginx configure was complaining about libmodsecurity not found. Command line I was using:
./configure --with-http_ssl_module --with-threads --with-compat --add-dynamic-module=/usr/local/opt/ModSecurity-nginx/
I checked nginx/objs/autoconf.err and this is in it
----------------------------------------
checking for ModSecurity library in "/usr/local/opt/ModSecurity/src/.libs/" and "/usr/local/opt/ModSecurity/headers/" (specified by the MODSECURITY_LIB and MODSECURITY_INC env)
objs/autotest.c:6:5: error: implicitly declaring library function 'printf' with type 'int (const char *, ...)' [-Werror,-Wimplicit-function-declaration]
printf("hello");;
^
objs/autotest.c:6:5: note: include the header <stdio.h> or explicitly provide a declaration for 'printf'
1 error generated.
----------
#include <sys/types.h>
#include <unistd.h>
#include <modsecurity/modsecurity.h>
int main(void) {
printf("hello");;
return 0;
}
So I think you need to either set $NGX_INCLUDE_UNISTD_H or not use printf
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked config file at config#L15 and inspect how nginx/auto/feature generates the compile check shown in objs/autoconf.err. Re-run the provided nginx 1.20.2 configure command, then confirm the connector configure step no longer fails on the undeclared printf call.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, nginx
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100