httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cliff Woolley <cliffwool...@yahoo.com>
Subject mod_include recursive include checking bug
Date Fri, 24 Aug 2001 05:07:04 GMT

httpd-test revealed a bug in processing recursive includes for
relative-pathed files.  This patch fixes it, but it seems suboptimal... is
there are a faster way to test for this condition than doing a strcmp?
(PS: sorry about the line wraps.)

The problem is just that server/request.c sets rnew->uri to "INTERNALLY
GENERATED file-relative req" in this case, namely when this check _fails_:

    if (strncmp(rnew->filename, fdir, fdirlen) != 0
           && rnew->filename[fdirlen]
           && ap_strchr_c(rnew->filename + fdirlen, '/') == NULL)

This is not new behavior ... it's been around since rev 1.1 of request.c.
But I'd swear that mod_include used to work for this test.  Maybe the
recent canonical filenames changes just uncovered the bug?

--Cliff


Index: mod_include.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/filters/mod_include.c,v
retrieving revision 1.131
diff -u -d -r1.131 mod_include.c
--- mod_include.c       2001/08/24 04:50:49     1.131
+++ mod_include.c       2001/08/24 04:51:05
@@ -859,7 +859,9 @@
                         for (q = p; q != NULL; q = q->prev) {
                             if ((q->filename && rr->filename &&
                                     (strcmp(q->filename, rr->filename) ==
0)) ||
-                                (strcmp(q->uri, rr->uri) == 0))
+                                ((strcmp(q->uri, rr->uri) == 0) &&
+                                 (strcmp(q->uri, "INTERNALLY GENERATED "
+                                                 "file-relative req") !=
0)))
                             {
                                 founddupe = 1;
                                 break;

--------------------------------------------------------------
   Cliff Woolley
   cliffwoolley@yahoo.com
   Charlottesville, VA





Mime
View raw message