Skip to content

Commit

Permalink
Use consistent naming of configuration structures
Browse files Browse the repository at this point in the history
No functional changes.
  • Loading branch information
defanator committed Nov 30, 2018
1 parent 3e256b0 commit 6b7e59e
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 30 deletions.
6 changes: 3 additions & 3 deletions src/ngx_http_modsecurity_body_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ngx_http_modsecurity_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
ngx_chain_t *chain = in;
ngx_http_modsecurity_ctx_t *ctx = NULL;
#if defined(MODSECURITY_SANITY_CHECKS) && (MODSECURITY_SANITY_CHECKS)
ngx_http_modsecurity_conf_t *loc_cf = NULL;
ngx_http_modsecurity_conf_t *mcf;
ngx_list_part_t *part = &r->headers_out.headers.part;
ngx_table_elt_t *data = part->elts;
ngx_uint_t i = 0;
Expand All @@ -57,8 +57,8 @@ ngx_http_modsecurity_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
}

#if defined(MODSECURITY_SANITY_CHECKS) && (MODSECURITY_SANITY_CHECKS)
loc_cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
if (loc_cf != NULL && loc_cf->sanity_checks_enabled != NGX_CONF_UNSET)
mcf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
if (mcf != NULL && mcf->sanity_checks_enabled != NGX_CONF_UNSET)
{
#if 0
dd("dumping stored ctx headers");
Expand Down
10 changes: 5 additions & 5 deletions src/ngx_http_modsecurity_header_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,17 @@ ngx_http_modsecurity_header_out_t ngx_http_modsecurity_headers_out[] = {
int
ngx_http_modescurity_store_ctx_header(ngx_http_request_t *r, ngx_str_t *name, ngx_str_t *value)
{
ngx_http_modsecurity_ctx_t *ctx = NULL;
ngx_http_modsecurity_header_t *hdr = NULL;
ngx_http_modsecurity_conf_t *loc_cf = NULL;
ngx_http_modsecurity_ctx_t *ctx;
ngx_http_modsecurity_conf_t *mcf;
ngx_http_modsecurity_header_t *hdr;

ctx = ngx_http_get_module_ctx(r, ngx_http_modsecurity_module);
if (ctx == NULL || ctx->sanity_headers_out == NULL) {
return NGX_ERROR;
}

loc_cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
if (loc_cf == NULL || loc_cf->sanity_checks_enabled == NGX_CONF_UNSET)
mcf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
if (mcf == NULL || mcf->sanity_checks_enabled == NGX_CONF_UNSET)
{
return NGX_OK;
}
Expand Down
10 changes: 5 additions & 5 deletions src/ngx_http_modsecurity_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ ngx_http_modsecurity_log(void *log, const void* data)
ngx_int_t
ngx_http_modsecurity_log_handler(ngx_http_request_t *r)
{
ngx_http_modsecurity_ctx_t *ctx = NULL;
ngx_http_modsecurity_conf_t *cf;
ngx_pool_t *old_pool;
ngx_pool_t *old_pool;
ngx_http_modsecurity_ctx_t *ctx;
ngx_http_modsecurity_conf_t *mcf;

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

cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
if (cf == NULL || cf->enable != 1)
mcf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
if (mcf == NULL || mcf->enable != 1)
{
dd("ModSecurity not enabled... returning");
return NGX_OK;
Expand Down
14 changes: 7 additions & 7 deletions src/ngx_http_modsecurity_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ ngx_http_modsecurity_create_ctx(ngx_http_request_t *r)
ngx_str_t s;
ngx_pool_cleanup_t *cln;
ngx_http_modsecurity_ctx_t *ctx;
ngx_http_modsecurity_conf_t *mlcf;
ngx_http_modsecurity_conf_t *mcf;
ngx_http_modsecurity_main_conf_t *mmcf;

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

mmcf = ngx_http_get_module_main_conf(r, ngx_http_modsecurity_module);
mlcf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
mcf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);

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

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

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

dd("transaction created");
Expand Down
10 changes: 5 additions & 5 deletions src/ngx_http_modsecurity_pre_access.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ ngx_int_t
ngx_http_modsecurity_pre_access_handler(ngx_http_request_t *r)
{
#if 1
ngx_http_modsecurity_ctx_t *ctx = NULL;
ngx_http_modsecurity_conf_t *cf;
ngx_pool_t *old_pool;
ngx_pool_t *old_pool;
ngx_http_modsecurity_ctx_t *ctx;
ngx_http_modsecurity_conf_t *mcf;

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

cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
if (cf == NULL || cf->enable != 1)
mcf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
if (mcf == NULL || mcf->enable != 1)
{
dd("ModSecurity not enabled... returning");
return NGX_DECLINED;
Expand Down
10 changes: 5 additions & 5 deletions src/ngx_http_modsecurity_rewrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
ngx_int_t
ngx_http_modsecurity_rewrite_handler(ngx_http_request_t *r)
{
ngx_http_modsecurity_ctx_t *ctx = NULL;
ngx_http_modsecurity_conf_t *cf;
ngx_pool_t *old_pool;
ngx_pool_t *old_pool;
ngx_http_modsecurity_ctx_t *ctx;
ngx_http_modsecurity_conf_t *mcf;

cf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
if (cf == NULL || cf->enable != 1) {
mcf = ngx_http_get_module_loc_conf(r, ngx_http_modsecurity_module);
if (mcf == NULL || mcf->enable != 1) {
dd("ModSecurity not enabled... returning");
return NGX_DECLINED;
}
Expand Down

0 comments on commit 6b7e59e

Please sign in to comment.