You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by bn...@apache.org on 2002/02/04 23:26:28 UTC

cvs commit: apache-1.3/src/include httpd.h

bnicholes    02/02/04 14:26:28

  Modified:    src/os/netware os.c ApacheCore.imp
               src/include httpd.h
  Log:
  Implemented the real ap_os_case_canonical_filename() function so that we
  can get the accurately cased filename from the file system.
  
  Revision  Changes    Path
  1.22      +43 -0     apache-1.3/src/os/netware/os.c
  
  Index: os.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/os/netware/os.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- os.c	2 Jan 2002 22:47:13 -0000	1.21
  +++ os.c	4 Feb 2002 22:26:28 -0000	1.22
  @@ -193,6 +193,49 @@
       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
  
  
  
  1.13      +1 -0      apache-1.3/src/os/netware/ApacheCore.imp
  
  Index: ApacheCore.imp
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/os/netware/ApacheCore.imp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ApacheCore.imp	20 Jan 2002 22:45:14 -0000	1.12
  +++ ApacheCore.imp	4 Feb 2002 22:26:28 -0000	1.13
  @@ -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,
  
  
  
  1.353     +3 -0      apache-1.3/src/include/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/include/httpd.h,v
  retrieving revision 1.352
  retrieving revision 1.353
  diff -u -r1.352 -r1.353
  --- httpd.h	21 Jan 2002 19:29:37 -0000	1.352
  +++ httpd.h	4 Feb 2002 22:26:28 -0000	1.353
  @@ -1128,6 +1128,9 @@
   #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)