MCPcopy Create free account
hub / github.com/apache/httpd / find_allowdeny

Function find_allowdeny

modules/aaa/mod_access_compat.c:242–305  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240}
241
242static int find_allowdeny(request_rec *r, apr_array_header_t *a, int method)
243{
244
245 allowdeny *ap = (allowdeny *) a->elts;
246 apr_int64_t mmask = (AP_METHOD_BIT << method);
247 int i;
248 int gothost = 0;
249 const char *remotehost = NULL;
250
251 for (i = 0; i < a->nelts; ++i) {
252 if (!(mmask & ap[i].limited)) {
253 continue;
254 }
255
256 switch (ap[i].type) {
257 case T_ENV:
258 if (apr_table_get(r->subprocess_env, ap[i].x.from)) {
259 return 1;
260 }
261 break;
262
263 case T_NENV:
264 if (!apr_table_get(r->subprocess_env, ap[i].x.from)) {
265 return 1;
266 }
267 break;
268
269 case T_ALL:
270 return 1;
271
272 case T_IP:
273 if (apr_ipsubnet_test(ap[i].x.ip, r->useragent_addr)) {
274 return 1;
275 }
276 break;
277
278 case T_HOST:
279 if (!gothost) {
280 int remotehost_is_ip;
281
282 remotehost = ap_get_useragent_host(r, REMOTE_DOUBLE_REV,
283 &remotehost_is_ip);
284
285 if ((remotehost == NULL) || remotehost_is_ip) {
286 gothost = 1;
287 }
288 else {
289 gothost = 2;
290 }
291 }
292
293 if ((gothost == 2) && in_domain(ap[i].x.from, remotehost)) {
294 return 1;
295 }
296 break;
297
298 case T_FAIL:
299 /* do nothing? */

Callers 1

check_dir_accessFunction · 0.85

Calls 2

ap_get_useragent_hostFunction · 0.85
in_domainFunction · 0.70

Tested by

no test coverage detected