]> granicus.if.org Git - apache/commitdiff
ap_server_root_relative never guarenteed that the resource exists, or
authorWilliam A. Rowe Jr <wrowe@apache.org>
Tue, 14 Jan 2003 16:56:16 +0000 (16:56 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Tue, 14 Jan 2003 16:56:16 +0000 (16:56 +0000)
  isn't a file pattern.  Correct the code to accept these cases (applied
  to both 2.0 and 2.1.)

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98264 13f79535-47bb-0310-9956-ffa450edef68

server/config.c

index b50adbd606aebc94a1c4729491eb473b36d2bab6..f7ab12b0b887914388513f19ece3731570eb767f 100644 (file)
@@ -1276,12 +1276,18 @@ static cmd_parms default_parms =
 
 AP_DECLARE(char *) ap_server_root_relative(apr_pool_t *p, const char *file)
 {
-    char *newpath;
-    if (apr_filepath_merge(&newpath, ap_server_root, file,
-                           APR_FILEPATH_TRUENAME, p) == APR_SUCCESS)
+    char *newpath = NULL;
+    apr_status_t rv;
+    rv = apr_filepath_merge(&newpath, ap_server_root, file,
+                            APR_FILEPATH_TRUENAME, p);
+    if (newpath && (rv == APR_SUCCESS || APR_STATUS_IS_EPATHWILD(rv) 
+                                      || APR_STATUS_IS_ENOENT(rv)
+                                      || APR_STATUS_IS_ENOTDIR(rv)) {
         return newpath;
-    else
+    }
+    else {
         return NULL;
+    }
 }
 
 AP_DECLARE(const char *) ap_soak_end_container(cmd_parms *cmd, char *directive)