]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Fixed ap_os_canonical_filename() and ap_os_is_path_absolute() so that they
authorBradley Nicholes <bnicholes@apache.org>
Tue, 21 Aug 2001 20:22:09 +0000 (20:22 +0000)
committerBradley Nicholes <bnicholes@apache.org>
Tue, 21 Aug 2001 20:22:09 +0000 (20:22 +0000)
would recognize special file names such as proxy:http://blah correctly.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@90475 13f79535-47bb-0310-9956-ffa450edef68

src/os/netware/os.c
src/os/netware/os.h

index 5b534090df9f5d0ac9bada0f28c4b74cfe78ef68..4aeaeead60211a66b9f4901540a7ae67b194ef0d 100644 (file)
@@ -168,19 +168,25 @@ char *ap_os_canonical_filename(pool *pPool, const char *szFile)
     char *slash_test;
        
     bslash2slash(pNewName);
-    if ((pNewName[0] == '/') && (strchr (pNewName, ':') == NULL))
-    {
-        char vol[256];
-
-        _splitpath (ap_server_root, vol, NULL, NULL, NULL);
-        pNewName = ap_pstrcat (pPool, vol, pNewName, NULL);
-    }
-    if ((slash_test = strchr(pNewName, ':')) && (*(slash_test+1) != '/'))
-    {
-        char vol[_MAX_VOLUME+1];
+    /* Don't try to canonicalize a filename that isn't even valid
+        This way we don't mess up proxy requests or other kinds
+        of special filenames.
+    */
+    if (ap_os_is_filename_valid(pNewName)) {
+        if ((pNewName[0] == '/') && (strchr (pNewName, ':') == NULL))
+        {
+            char vol[256];
+
+            _splitpath (ap_server_root, vol, NULL, NULL, NULL);
+            pNewName = ap_pstrcat (pPool, vol, pNewName, NULL);
+        }
+        if ((slash_test = strchr(pNewName, ':')) && (*(slash_test+1) != '/'))
+        {
+            char vol[_MAX_VOLUME+1];
         
-        _splitpath (pNewName, vol, NULL, NULL, NULL);
-        pNewName = ap_pstrcat (pPool, vol, "/", pNewName+strlen(vol), NULL);
+            _splitpath (pNewName, vol, NULL, NULL, NULL);
+            pNewName = ap_pstrcat (pPool, vol, "/", pNewName+strlen(vol), NULL);
+        }
     }
     strlwr(pNewName);
     return pNewName;
index 85e363e6e48c28276e2a738f438f3a24e5b8f2cf..edb92449b896a61c6079f914f56d26ba0ae94a04 100644 (file)
@@ -138,16 +138,23 @@ void clean_parent_exit(int code);
 
 inline int ap_os_is_path_absolute(const char *file)
 {
-    char *s = strchr (file, ':');
+    char *s = strstr (file, "://");
+
+    /* First make sure we aren't looking at a URL such as
+        a proxy:http://blah.
+    */
+    if (!s) {
+        s = strchr (file, ':');
     
-    if (s) {
-        if (strncmp(s, "://", 3) != 0)
-           /* XXX: we assume that everything before the : is letters */
-            return 1;
-    }
-    else {
-        if (file[0] == '/')
-            return 1;
+        if (s) {
+            if (strncmp(s, "://", 3) != 0)
+               /* XXX: we assume that everything before the : is letters */
+                return 1;
+        }
+        else {
+            if (file[0] == '/')
+                return 1;
+        }
     }
        
     return 0;