Mercurial > hg > nginx-vendor-current
comparison src/http/modules/ngx_http_access_module.c @ 626:a7a5fa2e395b NGINX_1_0_3
nginx 1.0.3
*) Feature: the "auth_basic_user_file" directive supports "$apr1",
"{PLAIN}", and "{SSHA}" password encryption methods.
Thanks to Maxim Dounin.
*) Feature: the "geoip_org" directive and $geoip_org variable.
Thanks to Alexander Uskov, Arnaud Granal, and Denis F. Latypoff.
*) Feature: ngx_http_geo_module and ngx_http_geoip_module support IPv4
addresses mapped to IPv6 addresses.
*) Bugfix: a segmentation fault occurred in a worker process during
testing IPv4 address mapped to IPv6 address, if access or deny rules
were defined only for IPv6; the bug had appeared in 0.8.22.
*) Bugfix: a cached reponse may be broken if proxy/fastcgi/scgi/
uwsgi_cache_bypass and proxy/fastcgi/scgi/uwsgi_no_cache directive
values were different; the bug had appeared in 0.8.46.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 25 May 2011 00:00:00 +0400 |
parents | 53f5f04a64b8 |
children | d0f7a625f27c |
comparison
equal
deleted
inserted
replaced
625:30f948276abe | 626:a7a5fa2e395b |
---|---|
106 static ngx_int_t | 106 static ngx_int_t |
107 ngx_http_access_handler(ngx_http_request_t *r) | 107 ngx_http_access_handler(ngx_http_request_t *r) |
108 { | 108 { |
109 struct sockaddr_in *sin; | 109 struct sockaddr_in *sin; |
110 ngx_http_access_loc_conf_t *alcf; | 110 ngx_http_access_loc_conf_t *alcf; |
111 #if (NGX_HAVE_INET6) | |
112 u_char *p; | |
113 in_addr_t addr; | |
114 struct sockaddr_in6 *sin6; | |
115 #endif | |
111 | 116 |
112 alcf = ngx_http_get_module_loc_conf(r, ngx_http_access_module); | 117 alcf = ngx_http_get_module_loc_conf(r, ngx_http_access_module); |
113 | 118 |
114 #if (NGX_HAVE_INET6) | 119 switch (r->connection->sockaddr->sa_family) { |
115 | 120 |
116 if (alcf->rules6 && r->connection->sockaddr->sa_family == AF_INET6) { | 121 case AF_INET: |
117 u_char *p; | 122 if (alcf->rules) { |
118 in_addr_t addr; | 123 sin = (struct sockaddr_in *) r->connection->sockaddr; |
119 struct sockaddr_in6 *sin6; | 124 return ngx_http_access_inet(r, alcf, sin->sin_addr.s_addr); |
120 | 125 } |
126 break; | |
127 | |
128 #if (NGX_HAVE_INET6) | |
129 | |
130 case AF_INET6: | |
121 sin6 = (struct sockaddr_in6 *) r->connection->sockaddr; | 131 sin6 = (struct sockaddr_in6 *) r->connection->sockaddr; |
122 p = sin6->sin6_addr.s6_addr; | 132 p = sin6->sin6_addr.s6_addr; |
123 | 133 |
124 if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { | 134 if (alcf->rules && IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { |
125 addr = p[12] << 24; | 135 addr = p[12] << 24; |
126 addr += p[13] << 16; | 136 addr += p[13] << 16; |
127 addr += p[14] << 8; | 137 addr += p[14] << 8; |
128 addr += p[15]; | 138 addr += p[15]; |
129 return ngx_http_access_inet(r, alcf, htonl(addr)); | 139 return ngx_http_access_inet(r, alcf, htonl(addr)); |
130 } | 140 } |
131 | 141 |
132 return ngx_http_access_inet6(r, alcf, p); | 142 if (alcf->rules6) { |
133 } | 143 return ngx_http_access_inet6(r, alcf, p); |
134 | 144 } |
135 #endif | 145 |
136 | 146 #endif |
137 if (alcf->rules && r->connection->sockaddr->sa_family == AF_INET) { | |
138 sin = (struct sockaddr_in *) r->connection->sockaddr; | |
139 return ngx_http_access_inet(r, alcf, sin->sin_addr.s_addr); | |
140 } | 147 } |
141 | 148 |
142 return NGX_DECLINED; | 149 return NGX_DECLINED; |
143 } | 150 } |
144 | 151 |