Skip to content

Commit 4a39aaa

Browse files
defanatorFelipe Zimmerle
authored and
Felipe Zimmerle
committed
Use consistent naming of configuration structures
No functional changes.
1 parent fca69f2 commit 4a39aaa

6 files changed

+30
-30
lines changed

Diff for: src/ngx_http_modsecurity_body_filter.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ ngx_http_modsecurity_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
3838
ngx_chain_t *chain = in;
3939
ngx_http_modsecurity_ctx_t *ctx = NULL;
4040
#if defined(MODSECURITY_SANITY_CHECKS) && (MODSECURITY_SANITY_CHECKS)
41-
ngx_http_modsecurity_conf_t *loc_cf = NULL;
41+
ngx_http_modsecurity_conf_t *mcf;
4242
ngx_list_part_t *part = &r->headers_out.headers.part;
4343
ngx_table_elt_t *data = part->elts;
4444
ngx_uint_t i = 0;
@@ -57,8 +57,8 @@ ngx_http_modsecurity_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
5757
}
5858

5959
#if defined(MODSECURITY_SANITY_CHECKS) && (MODSECURITY_SANITY_CHECKS)
60-
loc_cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
61-
if (loc_cf != NULL && loc_cf->sanity_checks_enabled != NGX_CONF_UNSET)
60+
mcf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
61+
if (mcf != NULL && mcf->sanity_checks_enabled != NGX_CONF_UNSET)
6262
{
6363
#if 0
6464
dd("dumping stored ctx headers");

Diff for: src/ngx_http_modsecurity_header_filter.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,17 @@ ngx_http_modsecurity_header_out_t ngx_http_modsecurity_headers_out[] = {
103103
int
104104
ngx_http_modescurity_store_ctx_header(ngx_http_request_t *r, ngx_str_t *name, ngx_str_t *value)
105105
{
106-
ngx_http_modsecurity_ctx_t *ctx = NULL;
107-
ngx_http_modsecurity_header_t *hdr = NULL;
108-
ngx_http_modsecurity_conf_t *loc_cf = NULL;
106+
ngx_http_modsecurity_ctx_t *ctx;
107+
ngx_http_modsecurity_conf_t *mcf;
108+
ngx_http_modsecurity_header_t *hdr;
109109

110110
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_module);
116-
if (loc_cf == NULL || loc_cf->sanity_checks_enabled == NGX_CONF_UNSET)
115+
mcf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
116+
if (mcf == NULL || mcf->sanity_checks_enabled == NGX_CONF_UNSET)
117117
{
118118
return NGX_OK;
119119
}

Diff for: src/ngx_http_modsecurity_log.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ ngx_http_modsecurity_log(void *log, const void* data)
3737
ngx_int_t
3838
ngx_http_modsecurity_log_handler(ngx_http_request_t *r)
3939
{
40-
ngx_http_modsecurity_ctx_t *ctx = NULL;
41-
ngx_http_modsecurity_conf_t *cf;
42-
ngx_pool_t *old_pool;
40+
ngx_pool_t *old_pool;
41+
ngx_http_modsecurity_ctx_t *ctx;
42+
ngx_http_modsecurity_conf_t *mcf;
4343

4444
dd("catching a new _log_ phase handler");
4545

46-
cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
47-
if (cf == NULL || cf->enable != 1)
46+
mcf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
47+
if (mcf == NULL || mcf->enable != 1)
4848
{
4949
dd("ModSecurity not enabled... returning");
5050
return NGX_OK;

Diff for: src/ngx_http_modsecurity_module.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ ngx_http_modsecurity_create_ctx(ngx_http_request_t *r)
237237
ngx_str_t s;
238238
ngx_pool_cleanup_t *cln;
239239
ngx_http_modsecurity_ctx_t *ctx;
240-
ngx_http_modsecurity_conf_t *mlcf;
240+
ngx_http_modsecurity_conf_t *mcf;
241241
ngx_http_modsecurity_main_conf_t *mmcf;
242242

243243
ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_modsecurity_ctx_t));
@@ -248,18 +248,18 @@ ngx_http_modsecurity_create_ctx(ngx_http_request_t *r)
248248
}
249249

250250
mmcf = ngx_http_get_module_main_conf(r, ngx_http_modsecurity_module);
251-
mlcf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
251+
mcf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
252252

253-
dd("creating transaction with the following rules: '%p' -- ms: '%p'", mlcf->rules_set, mmcf->modsec);
253+
dd("creating transaction with the following rules: '%p' -- ms: '%p'", mcf->rules_set, mmcf->modsec);
254254

255-
if (mlcf->transaction_id) {
256-
if (ngx_http_complex_value(r, mlcf->transaction_id, &s) != NGX_OK) {
255+
if (mcf->transaction_id) {
256+
if (ngx_http_complex_value(r, mcf->transaction_id, &s) != NGX_OK) {
257257
return NGX_CONF_ERROR;
258258
}
259-
ctx->modsec_transaction = msc_new_transaction_with_id(mmcf->modsec, mlcf->rules_set, (char *) s.data, r->connection->log);
259+
ctx->modsec_transaction = msc_new_transaction_with_id(mmcf->modsec, mcf->rules_set, (char *) s.data, r->connection->log);
260260

261261
} else {
262-
ctx->modsec_transaction = msc_new_transaction(mmcf->modsec, mlcf->rules_set, r->connection->log);
262+
ctx->modsec_transaction = msc_new_transaction(mmcf->modsec, mcf->rules_set, r->connection->log);
263263
}
264264

265265
dd("transaction created");

Diff for: src/ngx_http_modsecurity_pre_access.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ ngx_int_t
4444
ngx_http_modsecurity_pre_access_handler(ngx_http_request_t *r)
4545
{
4646
#if 1
47-
ngx_http_modsecurity_ctx_t *ctx = NULL;
48-
ngx_http_modsecurity_conf_t *cf;
49-
ngx_pool_t *old_pool;
47+
ngx_pool_t *old_pool;
48+
ngx_http_modsecurity_ctx_t *ctx;
49+
ngx_http_modsecurity_conf_t *mcf;
5050

5151
dd("catching a new _preaccess_ phase handler");
5252

53-
cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
54-
if (cf == NULL || cf->enable != 1)
53+
mcf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
54+
if (mcf == NULL || mcf->enable != 1)
5555
{
5656
dd("ModSecurity not enabled... returning");
5757
return NGX_DECLINED;

Diff for: src/ngx_http_modsecurity_rewrite.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
ngx_int_t
2424
ngx_http_modsecurity_rewrite_handler(ngx_http_request_t *r)
2525
{
26-
ngx_http_modsecurity_ctx_t *ctx = NULL;
27-
ngx_http_modsecurity_conf_t *cf;
28-
ngx_pool_t *old_pool;
26+
ngx_pool_t *old_pool;
27+
ngx_http_modsecurity_ctx_t *ctx;
28+
ngx_http_modsecurity_conf_t *mcf;
2929

30-
cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
31-
if (cf == NULL || cf->enable != 1) {
30+
mcf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
31+
if (mcf == NULL || mcf->enable != 1) {
3232
dd("ModSecurity not enabled... returning");
3333
return NGX_DECLINED;
3434
}

0 commit comments

Comments
 (0)