Mailing List Archive

wildcard <Directory> patch...
This patch makes wildcard <Directory> entries work.

BTW, as a note on how to get a feature that some of us have wanted for
a while, the following keeps the server from reading any .htaccess
files at all until it gets to some directory explicitly named in a
<Directory> directive (because of the AllowOverride None).

<Directory />
AllowOverride None
<Limit GET PUT POST DELETE>
order allow,deny
deny from all
</Limit>
</Directory>

As a separate tweak, the <Limit> disables access to things which are
not in subdirectories of some other explicitly named directory, so
<!--#include file="/etc/passwd"--> stops working --- however, beware
--- if there are multiple paths to your DocumentRoot, (say, one via
the automounter and one not), you need to name them both or one of
them won't work, and your users will be really confused. (Like, this
broke one of my server tests...).

Users' public_html directories are enabled like so, including allowing
.htaccess files again...

<Directory /*/public_html*>
AllowOverride All
Options Indexes FollowSymLinks ExecCGI Includes MultiViews
<Limit GET POST>
order allow,deny
allow from all
</Limit>
</Directory>

...and it all seems to work.

*** http_request.c Sat Aug 19 12:32:00 1995
--- ../http_request.c Sat Aug 19 12:59:17 1995
***************
*** 170,176 ****
{
core_server_config *sconf = get_module_config (r->server->module_config,
&core_module);
! array_header *sec_array = sconf->sec;

core_dir_config **sec = (core_dir_config **)sec_array->elts;
int num_sec = sec_array->nelts;
--- 170,176 ----
{
core_server_config *sconf = get_module_config (r->server->module_config,
&core_module);
! array_header *sec_array = copy_array (r->pool, sconf->sec);

core_dir_config **sec = (core_dir_config **)sec_array->elts;
int num_sec = sec_array->nelts;
***************
*** 219,234 ****

for (j = 0; j < num_sec; ++j) {
void *entry_config = sec[j];
! core_dir_config *entry_core =
(core_dir_config *)get_module_config(entry_config, &core_module);
! char *entry_dir = entry_core->d;

! #ifdef NOTDEF
! if (is_matchexp(entry_dir) && !strcmp_match(this_dir, entry_dir))
this_conf = entry_config;
! else
! #endif
! if (!strcmp (this_dir, entry_dir))
this_conf = entry_config;
}

--- 219,242 ----

for (j = 0; j < num_sec; ++j) {
void *entry_config = sec[j];
! core_dir_config *entry_core;
! char *entry_dir;
!
! if (!entry_config) continue;
!
! entry_core =
(core_dir_config *)get_module_config(entry_config, &core_module);
! entry_dir = entry_core->d;

! if (is_matchexp(entry_dir) && !strcmp_match(this_dir, entry_dir)) {
! /* Don't try this wildcard again --- if it ends in '*'
! * it'll match again, and subdirectories won't be able to
! * override it...
! */
! sec[j] = NULL;
this_conf = entry_config;
! }
! else if (!strcmp (this_dir, entry_dir))
this_conf = entry_config;
}