nbs-system / naxsi

NAXSI is an open-source, high performance, low rules maintenance WAF for NGINX
GNU General Public License v3.0
4.8k stars 606 forks source link

Does not compile when -Werror is enabled #559

Closed RekGRpth closed 11 months ago

RekGRpth commented 3 years ago

does not compile with -Wmissing-prototypes -Werror

wargio commented 3 years ago

it's quite possible, but i do not see this an issue, just avoid using -Werror

RekGRpth commented 3 years ago

no, but You should just add "static" before non-public functions

RekGRpth commented 3 years ago

or add prototype to common header file

wargio commented 3 years ago

I do not know what warnings you are seeing, therefore i can't help on this, but you can send a PR to fix these issues, if you want.

RekGRpth commented 3 years ago

what warnings you are seeing

modules/naxsi/naxsi_src/naxsi_runtime.c:310:1: error: no previous prototype for 'ngx_http_naxsi_is_whitelist_adapted' [-Werror=missing-prototypes]
  310 | ngx_http_naxsi_is_whitelist_adapted(ngx_http_whitelist_rule_t* b,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
modules/naxsi/naxsi_src/naxsi_runtime.c:401:1: error: no previous prototype for 'nx_find_wl_in_hash' [-Werror=missing-prototypes]
  401 | nx_find_wl_in_hash(ngx_http_request_t*        req,
      | ^~~~~~~~~~~~~~~~~~
modules/naxsi/naxsi_src/naxsi_runtime.c:437:1: error: no previous prototype for 'nx_can_ignore_ip' [-Werror=missing-prototypes]
  437 | nx_can_ignore_ip(const ngx_str_t* mstr, ngx_http_naxsi_loc_conf_t* cf)
      | ^~~~~~~~~~~~~~~~
modules/naxsi/naxsi_src/naxsi_runtime.c:459:1: error: no previous prototype for 'nx_can_ignore_cidr' [-Werror=missing-prototypes]
  459 | nx_can_ignore_cidr(const ngx_str_t* mstr, ngx_http_naxsi_loc_conf_t* cf)
      | ^~~~~~~~~~~~~~~~~~
modules/naxsi/naxsi_src/naxsi_runtime.c:494:1: error: no previous prototype for 'ngx_http_naxsi_pcre_wrapper' [-Werror=missing-prototypes]
  494 | ngx_http_naxsi_pcre_wrapper(ngx_regex_compile_t* rx, unsigned char* str, unsigned int len)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
modules/naxsi/naxsi_src/naxsi_runtime.c:518:1: error: no previous prototype for 'ngx_http_naxsi_is_rule_whitelisted_rx' [-Werror=missing-prototypes]
  518 | ngx_http_naxsi_is_rule_whitelisted_rx(ngx_http_request_t*        req,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
modules/naxsi/naxsi_src/naxsi_runtime.c:677:1: error: no previous prototype for 'ngx_http_naxsi_is_rule_whitelisted_n' [-Werror=missing-prototypes]
  677 | ngx_http_naxsi_is_rule_whitelisted_n(ngx_http_request_t*        req,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
modules/naxsi/naxsi_src/naxsi_runtime.c:989:1: error: no previous prototype for 'ngx_http_append_log' [-Werror=missing-prototypes]
  989 | ngx_http_append_log(ngx_http_request_t* r, ngx_array_t* ostr, ngx_str_t* fragment, u_int* offset)
      | ^~~~~~~~~~~~~~~~~~~
modules/naxsi/naxsi_src/naxsi_runtime.c:1019:1: error: no previous prototype for 'ngx_http_nx_log' [-Werror=missing-prototypes]
 1019 | ngx_http_nx_log(ngx_http_request_ctx_t* ctx,
      | ^~~~~~~~~~~~~~~
modules/naxsi/naxsi_src/naxsi_runtime.c:1207:1: error: no previous prototype for 'replace_str' [-Werror=missing-prototypes]
 1207 | replace_str(const char* s, const char* oldW, const char* newW)
      | ^~~~~~~~~~~
modules/naxsi/naxsi_src/naxsi_runtime.c:1627:1: error: no previous prototype for 'ngx_http_spliturl_ruleset' [-Werror=missing-prototypes]
 1627 | ngx_http_spliturl_ruleset(ngx_pool_t*             pool,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~
modules/naxsi/naxsi_src/naxsi_runtime.c:2120:1: error: no previous prototype for 'nx_content_disposition_parse' [-Werror=missing-prototypes]
 2120 | nx_content_disposition_parse(unsigned char*      str,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
modules/naxsi/naxsi_src/naxsi_runtime.c:2236:1: error: no previous prototype for 'nx_content_type_parse' [-Werror=missing-prototypes]
 2236 | nx_content_type_parse(ngx_http_request_t* r, unsigned char** boundary, unsigned int* boundary_len)
      | ^~~~~~~~~~~~~~~~~~~~~
modules/naxsi/naxsi_src/naxsi_runtime.c:2259:1: error: no previous prototype for 'ngx_http_naxsi_multipart_parse' [-Werror=missing-prototypes]
 2259 | ngx_http_naxsi_multipart_parse(ngx_http_request_ctx_t* ctx,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc -c -fPIC -rdynamic -fno-omit-frame-pointer -W -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes -Werror -g -O  -rdynamic -fno-omit-frame-pointer -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/include -I modules/njs/nginx/../src -I modules/njs/nginx/../build -I modules/njs/nginx/../src -I modules/njs/nginx/../build -I /usr/include -I objs -I src/http -I src/http/modules -I src/http/v2 -I src/stream \
    -o objs/addon/naxsi_src/naxsi_skeleton.o \
    modules/naxsi/naxsi_src/naxsi_skeleton.c
modules/naxsi/naxsi_src/naxsi_runtime.c:2693:1: error: no previous prototype for 'ngx_http_naxsi_uri_parse' [-Werror=missing-prototypes]
 2693 | ngx_http_naxsi_uri_parse(ngx_http_naxsi_main_conf_t* main_cf,
      | ^~~~~~~~~~~~~~~~~~~~~~~~
modules/naxsi/naxsi_src/naxsi_runtime.c:2734:1: error: no previous prototype for 'ngx_http_naxsi_args_parse' [-Werror=missing-prototypes]
 2734 | ngx_http_naxsi_args_parse(ngx_http_naxsi_main_conf_t* main_cf,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~
modules/naxsi/naxsi_src/naxsi_runtime.c:2763:1: error: no previous prototype for 'ngx_http_naxsi_headers_parse' [-Werror=missing-prototypes]
 2763 | ngx_http_naxsi_headers_parse(ngx_http_naxsi_main_conf_t* main_cf,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc -c -fPIC -rdynamic -fno-omit-frame-pointer -W -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes -Werror -g -O  -rdynamic -fno-omit-frame-pointer -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/include -I modules/njs/nginx/../src -I modules/njs/nginx/../build -I modules/njs/nginx/../src -I modules/njs/nginx/../build -I /usr/include -I objs -I src/http -I src/http/modules -I src/http/v2 -I src/stream \
    -o objs/addon/naxsi_src/naxsi_json.o \
    modules/naxsi/naxsi_src/naxsi_json.c
cc -c -fPIC -rdynamic -fno-omit-frame-pointer -W -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes -Werror -g -O  -rdynamic -fno-omit-frame-pointer -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/include -I modules/njs/nginx/../src -I modules/njs/nginx/../build -I modules/njs/nginx/../src -I modules/njs/nginx/../build -I /usr/include -I objs -I src/http -I src/http/modules -I src/http/v2 -I src/stream \
    -o objs/addon/naxsi_src/naxsi_raw.o \
    modules/naxsi/naxsi_src/naxsi_raw.c
modules/naxsi/naxsi_src/naxsi_utils.c:97:1: error: no previous prototype for 'ngx_utf8_check' [-Werror=missing-prototypes]
   97 | ngx_utf8_check(ngx_str_t* str)
      | ^~~~~~~~~~~~~~
modules/naxsi/naxsi_src/naxsi_utils.c:427:1: error: no previous prototype for 'ngx_http_wlr_find' [-Werror=missing-prototypes]
  427 | ngx_http_wlr_find(ngx_conf_t*                cf,
      | ^~~~~~~~~~~~~~~~~
cc -c -fPIC -rdynamic -fno-omit-frame-pointer -W -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes -Werror -g -O  -rdynamic -fno-omit-frame-pointer -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/include -I modules/njs/nginx/../src -I modules/njs/nginx/../build -I modules/njs/nginx/../src -I modules/njs/nginx/../build -I /usr/include -I objs -I src/http -I src/http/modules -I src/http/v2 -I src/stream \
    -o objs/addon/naxsi_src/naxsi_net.o \
    modules/naxsi/naxsi_src/naxsi_net.c
cc -c -fPIC -rdynamic -fno-omit-frame-pointer -W -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes -Werror -g -O  -rdynamic -fno-omit-frame-pointer -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/include -I modules/njs/nginx/../src -I modules/njs/nginx/../build -I modules/njs/nginx/../src -I modules/njs/nginx/../build -I /usr/include -I objs -I src/http -I src/http/modules -I src/http/v2 -I src/stream \
    -o objs/addon/libinjection/libinjection_sqli.o \
    modules/naxsi/naxsi_src/ext/libinjection/libinjection_sqli.c
cc -c -fPIC -rdynamic -fno-omit-frame-pointer -W -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes -Werror -g -O  -rdynamic -fno-omit-frame-pointer -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/include -I modules/njs/nginx/../src -I modules/njs/nginx/../build -I modules/njs/nginx/../src -I modules/njs/nginx/../build -I /usr/include -I objs -I src/http -I src/http/modules -I src/http/v2 -I src/stream \
    -o objs/addon/libinjection/libinjection_xss.o \
    modules/naxsi/naxsi_src/ext/libinjection/libinjection_xss.c
modules/naxsi/naxsi_src/naxsi_raw.c:10:1: error: no previous prototype for 'ngx_http_naxsi_rawbody_parse' [-Werror=missing-prototypes]
   10 | ngx_http_naxsi_rawbody_parse(ngx_http_request_ctx_t* ctx,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc -c -fPIC -rdynamic -fno-omit-frame-pointer -W -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes -Werror -g -O  -rdynamic -fno-omit-frame-pointer -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/