Mailing List Archive

apache 0.8.9 gets AllowOverride wrong
Version: 0.8.9 and earlier.

Symptom: Apache does not apply any AllowOverride directives in access.conf
to the specified directory, but only to sub-directories.

e.g.
<Directory /web>
AllowOverride All
</Directory>

<Directory /web/public>
AllowOverride None
</Directory>

Gives the default allowoverride to /web, and 'All' to /web/public.

I noticed this by observing that with
<Directory />
AllowOverride None
</Directory>

Apache was still looking for /.htaccess

A patch is supplied.

David.

----------------------- begin file access.patch -----------------------
*** http_request.c~ Tue Aug 1 01:45:30 1995
--- http_request.c Thu Aug 17 11:57:26 1995
***************
*** 195,216 ****
if (S_ISDIR (r->finfo.st_mode)) ++num_dirs;

for (i = 1; i <= num_dirs; ++i) {
! core_dir_config *core_dir =
! (core_dir_config *)get_module_config(per_dir_defaults, &core_module);
! int allowed_here = core_dir->opts;
! int overrides_here = core_dir->override;
! int res;
! void *this_conf = NULL, *htaccess_conf = NULL;
char *this_dir = make_dirstr (r->pool, test_filename, i);
char *config_name = make_full_path(r->pool, this_dir,
sconf->access_name);
int j;

/* Do symlink checks first, because they are done with the
* permissions appropriate to the *parent* directory...
*/

! if ((res = check_symlinks (this_dir, allowed_here)))
return res;

/* Begin *this* level by looking for matching <Directory> sections from
--- 195,216 ----
if (S_ISDIR (r->finfo.st_mode)) ++num_dirs;

for (i = 1; i <= num_dirs; ++i) {
! core_dir_config *core_dir;
! int overrides_here, res;
! void *this_conf = NULL;
char *this_dir = make_dirstr (r->pool, test_filename, i);
char *config_name = make_full_path(r->pool, this_dir,
sconf->access_name);
int j;

+ core_dir = (core_dir_config *)
+ get_module_config(per_dir_defaults, &core_module);
+
/* Do symlink checks first, because they are done with the
* permissions appropriate to the *parent* directory...
*/

! if ((res = check_symlinks (this_dir, core_dir->opts)))
return res;

/* Begin *this* level by looking for matching <Directory> sections from
***************
*** 232,237 ****
--- 232,252 ----
this_conf = entry_config;
}

+ /* To determine whether .htaccess files are enabled, we need
+ * to merge the parent config and any matching per-directory entry
+ * in the config file.
+ */
+
+ overrides_here = core_dir->override;
+ if (this_conf)
+ { /* just merge the override part */
+ core_dir = (core_dir_config *)
+ get_module_config(this_conf, &core_module);
+ if (core_dir->override != OR_UNSET)
+ overrides_here = core_dir->override;
+ }
+
+
/* If .htaccess files are enabled, check for one. Note that if the
* same thing is set in a .htaccess file and access.conf, the latter
* takes precedence --- if something is in the config files, for a
***************
*** 239,253 ****
*/

if (overrides_here) {
res = parse_htaccess (&htaccess_conf, r, overrides_here,
this_dir, config_name);
if (res) return res;
- }

! if (htaccess_conf)
! per_dir_defaults =
! merge_per_dir_configs (r->pool, per_dir_defaults,
! htaccess_conf);

if (this_conf)
per_dir_defaults =
--- 254,270 ----
*/

if (overrides_here) {
+ void *htaccess_conf = NULL;
+
res = parse_htaccess (&htaccess_conf, r, overrides_here,
this_dir, config_name);
if (res) return res;

! if (htaccess_conf)
! per_dir_defaults =
! merge_per_dir_configs (r->pool, per_dir_defaults,
! htaccess_conf);
! }

if (this_conf)
per_dir_defaults =
------------------------ end file access.patch ------------------------