]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Implemented the real ap_os_case_canonical_filename() function so that we
authorBradley Nicholes <bnicholes@apache.org>
Mon, 4 Feb 2002 22:26:28 +0000 (22:26 +0000)
committerBradley Nicholes <bnicholes@apache.org>
Mon, 4 Feb 2002 22:26:28 +0000 (22:26 +0000)
can get the accurately cased filename from the file system.

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

src/include/httpd.h
src/os/netware/ApacheCore.imp
src/os/netware/os.c

index 1a8170162c3c410c9c8966f46c8af635c2e7b9f5..14c9cfc52fd4db5deda50a72a03a081ca6ef34b3 100644 (file)
@@ -1128,6 +1128,9 @@ API_EXPORT(char *) ap_os_systemcase_filename(pool *pPool, const char *szFile);
 #elif defined(OS2)
 API_EXPORT(char *) ap_os_case_canonical_filename(pool *pPool, const char *szFile);
 API_EXPORT(char *) ap_os_systemcase_filename(pool *pPool, const char *szFile);
+#elif defined(NETWARE)
+API_EXPORT(char *) ap_os_case_canonical_filename(pool *pPool, const char *szFile);
+#define ap_os_systemcase_filename(p,f) ap_os_case_canonical_filename(p,f)
 #else
 #define ap_os_case_canonical_filename(p,f) ap_os_canonical_filename(p,f)
 #define ap_os_systemcase_filename(p,f) ap_os_canonical_filename(p,f)
index 5458f7d082e04184fd0fcfe9391659f25b947540..a1aa7f758bf5580d08bc11f2d42b52d3eafd89a2 100644 (file)
  ap_stripprefix,
  ap_send_error_response,
  ap_os_canonical_filename,
+ ap_os_case_canonical_filename,
  ap_os_http_method,
  os_readdir,
  os_opendir,
index d5d8ed7b7fc228511059f90455454be67b49c563..09cb2383d57175ed79a2fb2029b3631ea29c04e5 100644 (file)
@@ -193,6 +193,49 @@ char *ap_os_canonical_filename(pool *pPool, const char *szFile)
     return pNewName;
 }
 
+
+char *ap_os_case_canonical_filename(pool *pPool, const char *szFile)
+{
+    /* First thing we need to do is get a copy of the 
+        canonicalized path */
+    char *pNewName = ap_os_canonical_filename(pPool, szFile);
+    int          volnum=0;
+    long  dirnum=0;
+    long  pathcount=0;
+    char *path;
+    char  vol[_MAX_VOLUME+1];
+    int   retval, x, y;
+           
+    /* See if path exists by trying to get the volume and directory number */
+    retval = FEMapPathVolumeDirToVolumeDir(pNewName, 0, 0, &volnum, &dirnum);
+    if (retval == 0) {
+        /* allocate a buffer and ask the file system for the real name of
+            the directory and file */
+        path = ap_palloc(pPool, strlen(pNewName)+2);
+        FEMapVolumeAndDirectoryToPath (volnum, dirnum, path, &pathcount);
+
+        /* The file system gives it back in a lengh preceded string so we
+            need to convert it to a null terminated string. */
+        x = 0;
+        while (pathcount-- > 0) {
+            y = path[x];
+            path[x] = '/';
+            x += y + 1;
+        }
+        path[x] = '\0';  /* null terminate the full path */
+
+        /* Get the name of the volume so that we can prepend it onto the path */
+        FEMapVolumeNumberToName (volnum, vol);
+        vol[vol[0]+1] = '\0';
+        pNewName = ap_pstrcat (pPool, &(vol[1]), ":", path, NULL);
+    }
+
+    /* At this point we either have a real case accurate path or 
+        our best guess whichis a lower cased path */
+    return pNewName;
+}
+
+
 /*
  * ap_os_is_filename_valid is given a filename, and returns 0 if the filename
  * is not valid for use on this system. On NetWare, this means it fails any