httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@locus.apache.org
Subject cvs commit: apache-1.3/src/os/os2 util_os2.c
Date Sun, 19 Mar 2000 16:15:36 GMT
bjh         00/03/19 08:15:36

  Modified:    src/include httpd.h
               src/os/os2 util_os2.c
  Log:
  Implement ap_os_systemcase_canonical_filename() for OS/2. This makes sure
  canonicalization (is that a word?) matches the file system's rules.
  
  Revision  Changes    Path
  1.311     +1 -1      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.310
  retrieving revision 1.311
  diff -u -r1.310 -r1.311
  --- httpd.h	2000/03/13 21:00:40	1.310
  +++ httpd.h	2000/03/19 16:15:35	1.311
  @@ -1091,7 +1091,7 @@
   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);
  -#define ap_os_systemcase_filename(p,f) ap_os_canonical_filename(p,f)
  +API_EXPORT(char *) ap_os_systemcase_filename(pool *pPool, const char *szFile);
   #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)
  
  
  
  1.8       +46 -1     apache-1.3/src/os/os2/util_os2.c
  
  Index: util_os2.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/os/os2/util_os2.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- util_os2.c	2000/03/11 13:39:15	1.7
  +++ util_os2.c	2000/03/19 16:15:35	1.8
  @@ -40,9 +40,54 @@
   
   
   
  -API_EXPORT(char *)ap_os_canonical_filename(pool *pPool, const char *szFile)
  +static void fix_component(char *path, char *lastcomp)
  +{
  +    FILEFINDBUF3 fb3;
  +    HDIR hDir = HDIR_CREATE;
  +    ULONG numNames = 1;
  +    ULONG rc = DosFindFirst( (UCHAR *)path, &hDir, FILE_NORMAL|FILE_DIRECTORY, &fb3,
sizeof(fb3), &numNames, FIL_STANDARD );
  +
  +    if (rc == 0)
  +        strcpy(lastcomp, fb3.achName);
  +
  +    DosFindClose(hDir);
  +}
  +
  +
  +
  +char *ap_os_systemcase_canonical_filename(pool *pPool, const char *szFile)
   {
       char *szCanonicalFile = ap_os_case_canonical_filename(pPool, szFile);
  +    int startslash = 2, slashnum=0;
  +    char *pos, *prevslash = NULL;
  +
  +    if (szCanonicalFile[0] == '/' && szCanonicalFile[1] == '/') /* a UNC name */
  +        startslash = 5;
  +
  +    for (pos = szCanonicalFile; *pos; pos++) {
  +        if (*pos == '/') {
  +            slashnum++;
  +            if (slashnum >= startslash) {
  +                *pos = 0;
  +                fix_component(szCanonicalFile, prevslash+1);
  +                *pos = '/';
  +            }
  +            prevslash = pos;
  +        }
  +    }
  +
  +    if (slashnum >= startslash) {
  +        fix_component(szCanonicalFile, prevslash+1);
  +    }
  +
  +    return szCanonicalFile;
  +}
  +
  +
  +
  +API_EXPORT(char *)ap_os_canonical_filename(pool *pPool, const char *szFile)
  +{
  +    char *szCanonicalFile = ap_os_systemcase_canonical_filename(pPool, szFile);
       strlwr(szCanonicalFile);
       return szCanonicalFile;
   }
  
  
  

Mime
View raw message