diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2007-09-22 19:02:39 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2007-09-22 19:02:39 +0000 |
| commit | 72963cd4e7e7efa954162066fbe1506208698106 (patch) | |
| tree | 0d52a9cdf73b78a9773da2f65cb38a1e76d7cb1a /src/http/modules/ngx_http_access_module.c | |
| parent | 5963fbae8ee06329e347d5fe113c649ed1aa179e (diff) | |
| download | nginx-72963cd4e7e7efa954162066fbe1506208698106.tar.gz nginx-72963cd4e7e7efa954162066fbe1506208698106.tar.bz2 | |
r1381 merge:
ignore meaningless bits in CIDR and warn about them
Diffstat (limited to 'src/http/modules/ngx_http_access_module.c')
| -rw-r--r-- | src/http/modules/ngx_http_access_module.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/http/modules/ngx_http_access_module.c b/src/http/modules/ngx_http_access_module.c index 2cd8a8f24..e4e87b243 100644 --- a/src/http/modules/ngx_http_access_module.c +++ b/src/http/modules/ngx_http_access_module.c @@ -137,6 +137,7 @@ ngx_http_access_rule(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { ngx_http_access_loc_conf_t *alcf = conf; + ngx_int_t rc; ngx_str_t *value; ngx_inet_cidr_t in_cidr; ngx_http_access_rule_t *rule; @@ -173,12 +174,19 @@ ngx_http_access_rule(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) return NGX_CONF_OK; } - if (ngx_ptocidr(&value[1], &in_cidr) == NGX_ERROR) { + rc = ngx_ptocidr(&value[1], &in_cidr); + + if (rc == NGX_ERROR) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid parameter \"%V\"", &value[1]); return NGX_CONF_ERROR; } + if (rc == NGX_DONE) { + ngx_conf_log_error(NGX_LOG_WARN, cf, 0, + "low address bits of %V are meaningless", &value[1]); + } + rule->mask = in_cidr.mask; rule->addr = in_cidr.addr; |
