Skip to content

Commit c72105a

Browse files
committed
rename module structure to match nginx style
ngx_http_modsecurity -> ngx_http_modsecurity_module
1 parent f6a5442 commit c72105a

8 files changed

+34
-34
lines changed

config

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ if [ -n "$MODSECURITY_INC" -o -n "$MODSECURITY_LIB" ]; then
4343

4444
if [ $ngx_found = no ]; then
4545
cat << END
46-
$0: error: ngx_http_modsecurity requires the ModSecurity library and MODSECURITY_LIB is defined as "$MODSECURITY_LIB" and MODSECURITY_INC (path for modsecurity.h) "$MODSECURITY_INC", but we cannot find ModSecurity there.
46+
$0: error: ngx_http_modsecurity_module requires the ModSecurity library and MODSECURITY_LIB is defined as "$MODSECURITY_LIB" and MODSECURITY_INC (path for modsecurity.h) "$MODSECURITY_INC", but we cannot find ModSecurity there.
4747
END
4848
exit 1
4949
fi
@@ -74,13 +74,13 @@ fi
7474

7575
if [ $ngx_found = no ]; then
7676
cat << END
77-
$0: error: ngx_http_modsecurity requires the ModSecurity library.
77+
$0: error: ngx_http_modsecurity_module requires the ModSecurity library.
7878
END
7979
exit 1
8080
fi
8181

8282

83-
ngx_addon_name=ngx_http_modsecurity
83+
ngx_addon_name=ngx_http_modsecurity_module
8484

8585
if test -n "$ngx_module_link"; then
8686
ngx_module_type=HTTP_FILTER
@@ -98,7 +98,7 @@ if test -n "$ngx_module_link"; then
9898
ngx_module_libs="$ngx_feature_libs"
9999
ngx_module_incs="$ngx_feature_path"
100100

101-
ngx_module_order="ngx_http_chunked_filter ngx_http_v2_filter_module $ngx_module_name"
101+
ngx_module_order="ngx_http_chunked_filter_module ngx_http_v2_filter_module $ngx_module_name"
102102

103103
. auto/module
104104
else
@@ -108,7 +108,7 @@ else
108108
CORE_INCS="$CORE_INCS $ngx_feature_path"
109109
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
110110

111-
HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES ngx_http_modsecurity"
111+
HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES ngx_http_modsecurity_module"
112112
NGX_ADDON_SRCS="\
113113
$NGX_ADDON_SRCS \
114114
$ngx_addon_dir/src/ngx_http_modsecurity_module.c \
@@ -132,7 +132,7 @@ fi
132132
# explicitly update module "ordering rules".
133133
#
134134
# Default runtime location of ngx_http_modsecurity_module is right before
135-
# ngx_http_chunked_filter module, but in case if ngx_http_v2_filter_module is
135+
# ngx_http_chunked_filter_module, but in case if ngx_http_v2_filter_module is
136136
# compiled in, we should put our module before ngx_http_v2_filter_module in
137137
# order to support SecRules processing for HTTP/2.0 requests.
138138
#

src/ngx_http_modsecurity_body_filter.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ ngx_http_modsecurity_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
4949
return ngx_http_next_body_filter(r, in);
5050
}
5151

52-
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity);
52+
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity_module);
5353

5454
dd("body filter, recovering ctx: %p", ctx);
5555

@@ -58,7 +58,7 @@ ngx_http_modsecurity_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
5858
}
5959

6060
#if defined(MODSECURITY_SANITY_CHECKS) && (MODSECURITY_SANITY_CHECKS)
61-
loc_cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity);
61+
loc_cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
6262
if (loc_cf != NULL && loc_cf->sanity_checks_enabled != NGX_CONF_UNSET)
6363
{
6464
#if 0
@@ -130,7 +130,7 @@ ngx_http_modsecurity_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
130130
{
131131
dd("%d header(s) were not inspected by ModSecurity, so exiting", worth_to_fail);
132132
return ngx_http_filter_finalize_request(r,
133-
&ngx_http_modsecurity, NGX_HTTP_INTERNAL_SERVER_ERROR);
133+
&ngx_http_modsecurity_module, NGX_HTTP_INTERNAL_SERVER_ERROR);
134134
}
135135
}
136136
#endif
@@ -155,7 +155,7 @@ ngx_http_modsecurity_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
155155
ret = ngx_http_modsecurity_process_intervention(ctx->modsec_transaction, r);
156156
if (ret > 0) {
157157
return ngx_http_filter_finalize_request(r,
158-
&ngx_http_modsecurity, ret);
158+
&ngx_http_modsecurity_module, ret);
159159
}
160160
}
161161

@@ -168,7 +168,7 @@ ngx_http_modsecurity_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
168168
}
169169
else if (ret < 0) {
170170
return ngx_http_filter_finalize_request(r,
171-
&ngx_http_modsecurity, NGX_HTTP_INTERNAL_SERVER_ERROR);
171+
&ngx_http_modsecurity_module, NGX_HTTP_INTERNAL_SERVER_ERROR);
172172
}
173173
}
174174
else

src/ngx_http_modsecurity_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ typedef struct {
8484
} ngx_http_modsecurity_header_out_t;
8585

8686

87-
extern ngx_module_t ngx_http_modsecurity;
87+
extern ngx_module_t ngx_http_modsecurity_module;
8888

8989
/* ngx_http_modsecurity_module.c */
9090
int ngx_http_modsecurity_process_intervention (Transaction *transaction, ngx_http_request_t *r);

src/ngx_http_modsecurity_header_filter.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ ngx_http_modescurity_store_ctx_header(ngx_http_request_t *r, ngx_str_t *name, ng
107107
ngx_http_modsecurity_header_t *hdr = NULL;
108108
ngx_http_modsecurity_loc_conf_t *loc_cf = NULL;
109109

110-
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity);
110+
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity_module);
111111
if (ctx == NULL || ctx->sanity_headers_out == NULL) {
112112
return NGX_ERROR;
113113
}
114114

115-
loc_cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity);
115+
loc_cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
116116
if (loc_cf == NULL || loc_cf->sanity_checks_enabled == NGX_CONF_UNSET)
117117
{
118118
return NGX_OK;
@@ -150,7 +150,7 @@ ngx_http_modsecurity_resolv_header_server(ngx_http_request_t *r, ngx_str_t name,
150150
ngx_str_t value;
151151

152152
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
153-
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity);
153+
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity_module);
154154

155155
if (r->headers_out.server == NULL) {
156156
if (clcf->server_tokens) {
@@ -184,7 +184,7 @@ ngx_http_modsecurity_resolv_header_date(ngx_http_request_t *r, ngx_str_t name, o
184184
ngx_http_modsecurity_ctx_t *ctx = NULL;
185185
ngx_str_t date;
186186

187-
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity);
187+
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity_module);
188188

189189
if (r->headers_out.date == NULL) {
190190
date.data = ngx_cached_http_time.data;
@@ -214,7 +214,7 @@ ngx_http_modsecurity_resolv_header_content_length(ngx_http_request_t *r, ngx_str
214214
ngx_str_t value;
215215
char buf[NGX_INT64_LEN+2];
216216

217-
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity);
217+
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity_module);
218218

219219
if (r->headers_out.content_length_n > 0)
220220
{
@@ -241,7 +241,7 @@ ngx_http_modsecurity_resolv_header_content_type(ngx_http_request_t *r, ngx_str_t
241241
{
242242
ngx_http_modsecurity_ctx_t *ctx = NULL;
243243

244-
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity);
244+
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity_module);
245245

246246
if (r->headers_out.content_type.len > 0)
247247
{
@@ -268,7 +268,7 @@ ngx_http_modsecurity_resolv_header_last_modified(ngx_http_request_t *r, ngx_str_
268268
u_char buf[1024], *p;
269269
ngx_str_t value;
270270

271-
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity);
271+
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity_module);
272272

273273
if (r->headers_out.last_modified_time == -1) {
274274
return 1;
@@ -300,7 +300,7 @@ ngx_http_modsecurity_resolv_header_connection(ngx_http_request_t *r, ngx_str_t n
300300
ngx_str_t value;
301301

302302
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
303-
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity);
303+
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity_module);
304304

305305
if (r->headers_out.status == NGX_HTTP_SWITCHING_PROTOCOLS) {
306306
connection = "upgrade";
@@ -351,7 +351,7 @@ ngx_http_modsecurity_resolv_header_transfer_encoding(ngx_http_request_t *r, ngx_
351351
if (r->chunked) {
352352
ngx_str_t value = ngx_string("chunked");
353353

354-
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity);
354+
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity_module);
355355

356356
#if defined(MODSECURITY_SANITY_CHECKS) && (MODSECURITY_SANITY_CHECKS)
357357
ngx_http_modescurity_store_ctx_header(r, &name, &value);
@@ -378,7 +378,7 @@ ngx_http_modsecurity_resolv_header_vary(ngx_http_request_t *r, ngx_str_t name, o
378378
if (r->gzip_vary && clcf->gzip_vary) {
379379
ngx_str_t value = ngx_string("Accept-Encoding");
380380

381-
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity);
381+
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity_module);
382382

383383
#if defined(MODSECURITY_SANITY_CHECKS) && (MODSECURITY_SANITY_CHECKS)
384384
ngx_http_modescurity_store_ctx_header(r, &name, &value);
@@ -419,7 +419,7 @@ ngx_http_modsecurity_header_filter(ngx_http_request_t *r)
419419

420420
/* XXX: if NOT_MODIFIED, do we need to process it at all? see xslt_header_filter() */
421421

422-
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity);
422+
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity_module);
423423

424424
dd("header filter, recovering ctx: %p", ctx);
425425

src/ngx_http_modsecurity_log.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ ngx_http_modsecurity_log_handler(ngx_http_request_t *r)
3939

4040
dd("catching a new _log_ phase handler");
4141

42-
cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity);
42+
cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
4343
if (cf == NULL || cf->enable != 1)
4444
{
4545
dd("ModSecurity not enabled... returning");
@@ -53,7 +53,7 @@ ngx_http_modsecurity_log_handler(ngx_http_request_t *r)
5353
return NGX_OK;
5454
}
5555

56-
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity);
56+
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity_module);
5757

5858
dd("recovering ctx: %p", ctx);
5959

src/ngx_http_modsecurity_module.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,16 +161,16 @@ ngx_http_modsecurity_create_ctx(ngx_http_request_t *r)
161161
dd("failed to allocate memory for the context.");
162162
return NULL;
163163
}
164-
cf = ngx_http_get_module_main_conf(r, ngx_http_modsecurity);
165-
loc_cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity);
164+
cf = ngx_http_get_module_main_conf(r, ngx_http_modsecurity_module);
165+
loc_cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
166166

167167
dd("creating transaction with the following rules: '%p' -- ms: '%p'", loc_cf->rules_set, cf->modsec);
168168

169169
ctx->modsec_transaction = msc_new_transaction(cf->modsec, loc_cf->rules_set, r->connection->log);
170170

171171
dd("transaction created");
172172

173-
ngx_http_set_ctx(r, ctx, ngx_http_modsecurity);
173+
ngx_http_set_ctx(r, ctx, ngx_http_modsecurity_module);
174174

175175
cln = ngx_pool_cleanup_add(r->pool, sizeof(ngx_http_modsecurity_ctx_t));
176176
if (cln == NULL)
@@ -276,7 +276,7 @@ static ngx_http_module_t ngx_http_modsecurity_ctx = {
276276
};
277277

278278

279-
ngx_module_t ngx_http_modsecurity = {
279+
ngx_module_t ngx_http_modsecurity_module = {
280280
NGX_MODULE_V1,
281281
&ngx_http_modsecurity_ctx, /* module context */
282282
ngx_http_modsecurity_commands, /* module directives */

src/ngx_http_modsecurity_pre_access.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ngx_http_modsecurity_request_read(ngx_http_request_t *r)
2525
{
2626
ngx_http_modsecurity_ctx_t *ctx;
2727

28-
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity);
28+
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity_module);
2929

3030
#if defined(nginx_version) && nginx_version >= 8011
3131
r->main->count--;
@@ -48,7 +48,7 @@ ngx_http_modsecurity_pre_access_handler(ngx_http_request_t *r)
4848

4949
dd("catching a new _preaccess_ phase handler");
5050

51-
cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity);
51+
cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
5252
if (cf == NULL || cf->enable != 1)
5353
{
5454
dd("ModSecurity not enabled... returning");
@@ -61,7 +61,7 @@ ngx_http_modsecurity_pre_access_handler(ngx_http_request_t *r)
6161
return NGX_DECLINED;
6262
}
6363

64-
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity);
64+
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity_module);
6565

6666
dd("recovering ctx: %p", ctx);
6767

src/ngx_http_modsecurity_rewrite.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ ngx_http_modsecurity_rewrite_handler(ngx_http_request_t *r)
2626
ngx_http_modsecurity_ctx_t *ctx = NULL;
2727
ngx_http_modsecurity_loc_conf_t *cf;
2828

29-
cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity);
29+
cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
3030
if (cf == NULL || cf->enable != 1) {
3131
dd("ModSecurity not enabled... returning");
3232
return NGX_DECLINED;
@@ -41,7 +41,7 @@ ngx_http_modsecurity_rewrite_handler(ngx_http_request_t *r)
4141

4242
dd("catching a new _rewrite_ phase handler");
4343

44-
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity);
44+
ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity_module);
4545

4646
dd("recovering ctx: %p", ctx);
4747

0 commit comments

Comments
 (0)