fielding 98/09/25 17:07:09
Modified: src CHANGES src/main http_config.c Log: Reconstructed the loop through multiple htaccess file names so that missing files are not confused with unreadable files. Revision Changes Path 1.1081 +4 -0 apache-1.3/src/CHANGES Index: CHANGES =================================================================== RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1080 retrieving revision 1.1081 diff -u -r1.1080 -r1.1081 --- CHANGES 1998/09/25 23:24:18 1.1080 +++ CHANGES 1998/09/26 00:07:06 1.1081 @@ -1,5 +1,9 @@ Changes with Apache 1.3.3 + *) Reconstructed the loop through multiple htaccess file names so + that missing files are not confused with unreadable files. + [Roy Fielding] + *) The ap_pfopen and ap_pfdopen routines were failing to protect the errno on an error, which leads to one error being mistaken for another when reading non-existant .htaccess files. 1.134 +33 -35 apache-1.3/src/main/http_config.c Index: http_config.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/http_config.c,v retrieving revision 1.133 retrieving revision 1.134 diff -u -r1.133 -r1.134 --- http_config.c 1998/09/25 23:39:50 1.133 +++ http_config.c 1998/09/26 00:07:08 1.134 @@ -1206,7 +1206,7 @@ char *filename = NULL; const struct htaccess_result *cache; struct htaccess_result *new; - void *dc; + void *dc = NULL; /* firstly, search cache */ for (cache = r->htaccess; cache != NULL; cache = cache->next) @@ -1224,41 +1224,39 @@ parms.path = ap_pstrdup(r->pool, d); /* 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) { - dc = ap_create_per_dir_config(r->pool); - - parms.config_file = f; - - errmsg = ap_srm_command_loop(&parms, dc); - - ap_cfg_closefile(f); - - if (errmsg) { - ap_log_rerror(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, r, "%s: %s", - filename, errmsg); - return HTTP_INTERNAL_SERVER_ERROR; - } - *result = dc; - } - 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", - filename); - ap_table_setn(r->notes, "error-notes", - "Server unable to read htaccess file, denying " - "access to be safe"); - return HTTP_FORBIDDEN; - } + while (access_name[0]) { + filename = ap_make_full_path(r->pool, d, + ap_getword_conf(r->pool, &access_name)); + + if ((f = ap_pcfg_openfile(r->pool, filename)) != NULL) { + + dc = ap_create_per_dir_config(r->pool); + + parms.config_file = f; + + errmsg = ap_srm_command_loop(&parms, dc); + + ap_cfg_closefile(f); + + if (errmsg) { + ap_log_rerror(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, r, + "%s: %s", filename, errmsg); + return HTTP_INTERNAL_SERVER_ERROR; + } + *result = dc; + break; + } + else if (errno != ENOENT && errno != ENOTDIR) { + ap_log_rerror(APLOG_MARK, APLOG_CRIT, r, + "%s pcfg_openfile: unable to check htaccess file, " + "ensure it is readable", + filename); + ap_table_setn(r->notes, "error-notes", + "Server unable to read htaccess file, denying " + "access to be safe"); + return HTTP_FORBIDDEN; + } } /* cache it */