httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roy T. Fielding" <>
Subject Re: [PHP-DEV] Bug #784: stat() bug introduced in 3.0.4? (fwd)
Date Fri, 25 Sep 1998 07:25:10 GMT
>Try to get some info on that from people; the Apache message is designed
>to be printed when open() on a htaccess fails with a unknown error.

Note that the bug reports indicate errno == 0.

I'll bet it has something to do with pathname canonicalization
triggering the other condition that makes the following code in
http_config.c totally bogus:

    /* loop through the access names and find the first one */
    while (!f && access_name[0]) {
        char *w = ap_getword_conf(r->pool, &access_name);
        filename = ap_make_full_path(r->pool, d, w);
        f = ap_pcfg_openfile(r->pool, filename);
    if (f) {
      [... read the htaccess file ...]
    else {
        if (errno == ENOENT || errno == ENOTDIR)
            dc = NULL;
        else {
            ap_log_rerror(APLOG_MARK, APLOG_CRIT, r,
                          "%s pcfg_openfile: unable to check htaccess file, "
                          "ensure it is readable",
            ap_table_setn(r->notes, "error-notes",
                          "Server unable to read htaccess file, denying "
                          "access to be safe");
            return HTTP_FORBIDDEN;

Note that there are two exit conditions out of the first loop,
but the if condition only tests one, which was all fine and good until
the else clause was changed to an error return.  Keep in mind that
on most systems errno is only valid after an error on a system call.

And another thing, ap_pcfg_openfile calls ap_pfopen, which is not
protecting the errno from being trashed by calls after the open().

Unfortunately I don't have time to track down why we are just now
truncating the final slash or whatever it is that causes the error
to be triggered on normal systems now instead of with 1.3.0.
I'm off to bed.


View raw message