apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr/file_io/win32 filestat.c
Date Wed, 05 Sep 2001 04:43:28 GMT
wrowe       01/09/04 21:43:28

  Modified:    file_io/win32 filestat.c
  Log:
    Work around the fact that GetNamedSecurityInfoW for unicode pathnames
    is an odd beast that doesn't accept \\?\ notation.
  
  Submitted by:	Mats Nilsson <mats.nilsson@xware.se>
  
  Revision  Changes    Path
  1.56      +12 -2     apr/file_io/win32/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/filestat.c,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- filestat.c	2001/08/15 21:02:53	1.55
  +++ filestat.c	2001/09/05 04:43:28	1.56
  @@ -226,13 +226,23 @@
               sinf |= GROUP_SECURITY_INFORMATION;
           if (wanted & APR_FINFO_PROT)
               sinf |= DACL_SECURITY_INFORMATION;
  -        if (whatfile == MORE_OF_WFSPEC)
  -            rv = GetNamedSecurityInfoW((apr_wchar_t*)ufile, 
  +        if (whatfile == MORE_OF_WFSPEC) {
  +            apr_wchar_t *wfile = (apr_wchar_t*) ufile;
  +            int fix = 0;
  +            if (wcsncmp(wfile, L"\\\\?\\", 4)) {
  +                fix = 4;
  +                if (wcsncmp(wfile + fix, L"UNC\\", 4))
  +                    wfile[6] = L'\\', fix = 6;
  +            }
  +            rv = GetNamedSecurityInfoW(wfile + fix, 
                                    SE_FILE_OBJECT, sinf,
                                    ((wanted & APR_FINFO_USER) ? &user : NULL),
                                    ((wanted & APR_FINFO_GROUP) ? &grp : NULL),
                                    ((wanted & APR_FINFO_PROT) ? &dacl : NULL),
                                    NULL, &pdesc);
  +            if (fix == 6)
  +                wfile[6] = L'C';
  +        }
           else if (whatfile == MORE_OF_FSPEC)
               rv = GetNamedSecurityInfoA((char*)ufile, 
                                    SE_FILE_OBJECT, sinf,
  
  
  

Mime
View raw message