Bug 52845 - "DirectoryIndex disabled" cannot disable index files.
Summary: "DirectoryIndex disabled" cannot disable index files.
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_dir (show other bugs)
Version: 2.4.1
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-07 08:31 UTC by Tianyin Xu
Modified: 2015-04-04 21:03 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tianyin Xu 2012-03-07 08:31:17 UTC
In the configuration file, e.g., httpd.conf, if you have:

DirectoryIndex index.html index.txt
DirectoryIndex disabled

Then, all the previous index files (index.html, index.txt in this case) are not disabled. This violates the semantics of the DirectoryIndex directive.

If the two DirectoryIndex directives are seperated in a large httpd.conf (e.g., a lot of other directives are in between), this will bring confusion to users.

Looking at the code in modules/mappers/mod_dir.c (see below), you can find that
the previous list is not cleared when an alone "disabled" is encountered.


    while ((w = ap_getword_conf(cmd->pool, &t)) && w[0]) {
        if (count == 0 && !strcasecmp(w, "disabled")) {
            /* peek to see if "disabled" is first in a series of arguments */
            const char *tt = t;
            const char *ww = ap_getword_conf(cmd->temp_pool, &tt);
            if (ww == NULL || !ww[0]) {
               /* "disabled" is first, and alone */
               break;
            }
        }
        *(const char **)apr_array_push(d->index_names) = w;
        count++;
    }
Comment 1 Eric Covener 2012-03-07 12:22:48 UTC
Yes, it's only intended to disable settings in higher level configuration sections, but it looks like it could safely undo the current config section too.
Comment 2 Christophe JAILLET 2015-04-04 21:03:07 UTC
The behavior has been changed in r1300089 and has been released with 2.4.2.