ngx_http_access_module custom deny directive patch bug fix

This commit is contained in:
Fabiano Furtado 2025-09-16 23:27:30 -03:00
parent 0f75df35b6
commit 2a2683b643
No known key found for this signature in database
GPG Key ID: D871CE32E2B2E8E7
1 changed files with 8 additions and 8 deletions

View File

@ -14,7 +14,7 @@ typedef struct {
in_addr_t mask; in_addr_t mask;
in_addr_t addr; in_addr_t addr;
ngx_uint_t deny; /* unsigned deny:1; */ ngx_uint_t deny; /* unsigned deny:1; */
ngx_uint_t deny_status_code; ngx_int_t deny_status_code;
} ngx_http_access_rule_t; } ngx_http_access_rule_t;
#if (NGX_HAVE_INET6) #if (NGX_HAVE_INET6)
@ -23,7 +23,7 @@ typedef struct {
struct in6_addr addr; struct in6_addr addr;
struct in6_addr mask; struct in6_addr mask;
ngx_uint_t deny; /* unsigned deny:1; */ ngx_uint_t deny; /* unsigned deny:1; */
ngx_uint_t deny_status_code; ngx_int_t deny_status_code;
} ngx_http_access_rule6_t; } ngx_http_access_rule6_t;
#endif #endif
@ -32,7 +32,7 @@ typedef struct {
typedef struct { typedef struct {
ngx_uint_t deny; /* unsigned deny:1; */ ngx_uint_t deny; /* unsigned deny:1; */
ngx_uint_t deny_status_code; ngx_int_t deny_status_code;
} ngx_http_access_rule_un_t; } ngx_http_access_rule_un_t;
#endif #endif
@ -60,7 +60,7 @@ static ngx_int_t ngx_http_access_unix(ngx_http_request_t *r,
ngx_http_access_loc_conf_t *alcf); ngx_http_access_loc_conf_t *alcf);
#endif #endif
static ngx_int_t ngx_http_access_found(ngx_http_request_t *r, ngx_uint_t deny, static ngx_int_t ngx_http_access_found(ngx_http_request_t *r, ngx_uint_t deny,
ngx_uint_t deny_status_code); ngx_int_t deny_status_code);
static char *ngx_http_access_rule(ngx_conf_t *cf, ngx_command_t *cmd, static char *ngx_http_access_rule(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf); void *conf);
static void *ngx_http_access_create_loc_conf(ngx_conf_t *cf); static void *ngx_http_access_create_loc_conf(ngx_conf_t *cf);
@ -281,7 +281,7 @@ ngx_http_access_unix(ngx_http_request_t *r, ngx_http_access_loc_conf_t *alcf)
static ngx_int_t static ngx_int_t
ngx_http_access_found(ngx_http_request_t *r, ngx_uint_t deny, ngx_http_access_found(ngx_http_request_t *r, ngx_uint_t deny,
ngx_uint_t deny_status_code) ngx_int_t deny_status_code)
{ {
ngx_http_core_loc_conf_t *clcf; ngx_http_core_loc_conf_t *clcf;
@ -290,11 +290,11 @@ ngx_http_access_found(ngx_http_request_t *r, ngx_uint_t deny,
if (clcf->satisfy == NGX_HTTP_SATISFY_ALL) { if (clcf->satisfy == NGX_HTTP_SATISFY_ALL) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"access forbidden by rule with status %ui", "access denied by rule with status %ui",
deny_status_code); deny_status_code);
} }
return (ngx_int_t)deny_status_code; return deny_status_code;
} }
return NGX_OK; return NGX_OK;
@ -309,7 +309,7 @@ ngx_http_access_rule(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ngx_int_t rc; ngx_int_t rc;
ngx_uint_t all; ngx_uint_t all;
ngx_uint_t deny; ngx_uint_t deny;
ngx_uint_t deny_status_code; ngx_int_t deny_status_code;
ngx_str_t *value; ngx_str_t *value;
ngx_cidr_t cidr; ngx_cidr_t cidr;
ngx_http_access_rule_t *rule; ngx_http_access_rule_t *rule;