You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ja...@apache.org on 2019/09/04 19:11:28 UTC

svn commit: r1866418 - in /httpd/httpd/trunk: CHANGES server/core.c

Author: jailletc36
Date: Wed Sep  4 19:11:28 2019
New Revision: 1866418

URL: http://svn.apache.org/viewvc?rev=1866418&view=rev
Log:
Fix an issue on Windows where <IfFile> looks for a file on a non-existent drive (on a USB key that is not plugged for example)

Issue repported by Heather Lotz <knot22 hotmail.com>

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/server/core.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1866418&r1=1866417&r2=1866418&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Wed Sep  4 19:11:28 2019
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.1
 
+  *) core: On Windows, fix a start-up crash if <IfFile ...> is used with a path that is not
+     valid (For example, testing for a file on a flash drive that is not mounted)
+     [Christophe Jaillet]
+
   *) mod_proxy_balancer: Fix case-sensitive referer check related to CSRF/XSS 
      protection. PR63688. [Armin Abfalterer <a.abfalterer gmail.com>]
 

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=1866418&r1=1866417&r2=1866418&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Wed Sep  4 19:11:28 2019
@@ -2948,8 +2948,15 @@ static int test_iffile_section(cmd_parms
     const char *relative;
     apr_finfo_t sb;
 
+    /*
+     * At least on Windows, if the path we are testing is not valid (for example
+     * a path on a USB key that is not plugged), 'ap_server_root_relative()' will
+     * return NULL. In such a case, consider that the file is not there and that
+     * the section should be skipped.
+     */
     relative = ap_server_root_relative(cmd->temp_pool, arg);
-    return (apr_stat(&sb, relative, 0, cmd->pool) == APR_SUCCESS);
+    return (relative &&
+           (apr_stat(&sb, relative, APR_FINFO_TYPE, cmd->temp_pool) == APR_SUCCESS));
 }
 
 static int test_ifdirective_section(cmd_parms *cmd, const char *arg)