From: Bradley Nicholes Date: Mon, 4 Feb 2002 22:26:28 +0000 (+0000) Subject: Implemented the real ap_os_case_canonical_filename() function so that we X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=358f95e4abe267d8e777da54e3cb59c8b5403cd4;p=thirdparty%2Fapache%2Fhttpd.git Implemented the real ap_os_case_canonical_filename() function so that we 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 --- diff --git a/src/include/httpd.h b/src/include/httpd.h index 1a8170162c3..14c9cfc52fd 100644 --- a/src/include/httpd.h +++ b/src/include/httpd.h @@ -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) diff --git a/src/os/netware/ApacheCore.imp b/src/os/netware/ApacheCore.imp index 5458f7d082e..a1aa7f758bf 100644 --- a/src/os/netware/ApacheCore.imp +++ b/src/os/netware/ApacheCore.imp @@ -360,6 +360,7 @@ ap_stripprefix, ap_send_error_response, ap_os_canonical_filename, + ap_os_case_canonical_filename, ap_os_http_method, os_readdir, os_opendir, diff --git a/src/os/netware/os.c b/src/os/netware/os.c index d5d8ed7b7fc..09cb2383d57 100644 --- a/src/os/netware/os.c +++ b/src/os/netware/os.c @@ -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