* fhandler.h (enum query_state): Drop redundant query_stat_control.

* fhandler.cc (fhandler_base::open): Ditto.  Add READ_CONTROL to
	access and FILE_OPEN_FOR_BACKUP_INTENT to create_options when opening
	for writing.  Always set security attributes to avoid calling
	has_acls.
	* fhandler_disk_file.cc (fhandler_base::fstat_fs): Don't try to
	open file twice.
This commit is contained in:
Corinna Vinschen 2007-07-27 08:38:00 +00:00
parent 214c3a1167
commit fe7bbe1504
4 changed files with 18 additions and 20 deletions

View File

@ -1,3 +1,13 @@
2007-07-27 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (enum query_state): Drop redundant query_stat_control.
* fhandler.cc (fhandler_base::open): Ditto. Add READ_CONTROL to
access and FILE_OPEN_FOR_BACKUP_INTENT to create_options when opening
for writing. Always set security attributes to avoid calling
has_acls.
* fhandler_disk_file.cc (fhandler_base::fstat_fs): Don't try to
open file twice.
2007-07-26 Corinna Vinschen <corinna@vinschen.de>
* dir.cc (readdir_worker): Drop dir parameter from call to

View File

@ -483,10 +483,6 @@ fhandler_base::open (int flags, mode_t mode)
access = READ_CONTROL | FILE_READ_ATTRIBUTES;
create_options = FILE_OPEN_FOR_BACKUP_INTENT;
break;
case query_stat_control:
access = READ_CONTROL | FILE_READ_ATTRIBUTES;
create_options = FILE_OPEN_FOR_BACKUP_INTENT;
break;
case query_write_control:
access = READ_CONTROL | WRITE_OWNER | WRITE_DAC | FILE_WRITE_ATTRIBUTES;
create_options = FILE_OPEN_FOR_BACKUP_INTENT | FILE_OPEN_FOR_RECOVERY;
@ -503,8 +499,9 @@ fhandler_base::open (int flags, mode_t mode)
}
else if ((flags & O_ACCMODE) == O_WRONLY)
{
access = GENERIC_WRITE | FILE_READ_ATTRIBUTES;
create_options = FILE_OPEN_FOR_RECOVERY;
access = GENERIC_WRITE | READ_CONTROL | FILE_READ_ATTRIBUTES;
create_options = FILE_OPEN_FOR_BACKUP_INTENT
| FILE_OPEN_FOR_RECOVERY;
}
else
{
@ -560,7 +557,7 @@ fhandler_base::open (int flags, mode_t mode)
/* If the file should actually be created and ntsec is on,
set files attributes. */
if (allow_ntsec && has_acls ())
if (allow_ntsec)
{
set_security_attribute (mode, &sa, sd);
attr.SecurityDescriptor = sa.lpSecurityDescriptor;

View File

@ -86,9 +86,8 @@ enum query_state {
no_query = 0,
query_read_control = 1,
query_read_attributes = 2,
query_stat_control = 3,
query_write_control = 4,
query_write_attributes = 5
query_write_control = 3,
query_write_attributes = 4
};
class fhandler_base

View File

@ -425,16 +425,8 @@ fhandler_base::fstat_fs (struct __stat64 *buf)
res = fstat_by_name (buf);
return res;
}
query_open (query_stat_control);
if (!(oret = open_fs (open_flags, 0)) && get_errno () == EACCES)
{
/* If we couldn't open the file, try a query open with no permissions.
This allows us to determine *some* things about the file, at least. */
pc.set_exec (0);
query_open (query_read_attributes);
oret = open_fs (open_flags, 0);
}
query_open (query_read_attributes);
oret = open_fs (open_flags, 0);
if (oret)
{
/* We now have a valid handle, regardless of the "nohandle" state.