> brane 02/02/06 16:57:21
>
> Modified: file_io/win32 filestat.c
> Log:
> Even on NT, a file can be without a DACL -- for example, if it's in a
> FAT volume. In that case, the access rights are effectively 0777,
> modulo the readonly bit -- just like they're computed for Win9x.
>
> Before this change, apr_file_info_get would return APR_INCOMPLETE
> if APR_FILE_PROT was requested for such files.
Generally good and interesting patch ;) see my notes below for some required
bits to round this patch out.
> Revision Changes Path
> 1.63 +23 -17 apr/file_io/win32/filestat.c
>
> Index: filestat.c
> ===================================================================
> RCS file: /home/cvs/apr/file_io/win32/filestat.c,v
> retrieving revision 1.62
> retrieving revision 1.63
> diff -u -r1.62 -r1.63
> --- filestat.c 1 Feb 2002 01:40:38 -0000 1.62
> +++ filestat.c 7 Feb 2002 00:57:21 -0000 1.63
Note that we are always testing APR_FINFO_PROT - the test was duplicitous...
> + if (apr_os_level < APR_WIN_NT)
> + guess_protection_bits(finfo);
> else if (wanted & (APR_FINFO_PROT | APR_FINFO_OWNER))
> {
> /* On NT this request is incredibly expensive, but accurate.
> @@ -296,6 +300,8 @@
> /* Retrieved the discresionary access list */
> resolve_prot(finfo, wanted, dacl);
> }
> + else if (wanted & APR_FINFO_PROT)
> + guess_protection_bits(finfo);
> }
>
> return ((wanted & ~finfo->valid) ? APR_INCOMPLETE : APR_SUCCESS);
We don't need to 'ask' if the user wants the guess bits here. If we have the
data [don't need another kernel call] then provide the answer.
In this case, we've already tried for a DACL, come up empty, so we are going to
use the readonly bits to spit out a pseudo-answer. [I really think this code
is a bit bogus - I would rather see us check the LastError for confirmation that
it was a volume that doesn't support DACLs.] In any case, give them the answer
and set the APR_FINFO_PROT bits since we don't need another system call.
Bill