* autoload.cc (PrivilegeCheck): Define.

* fhandler.cc (fhandler_base::open): Always try opening with backup
	resp. restore intent.
	* fhandler_disk_file.cc (fhandler_disk_file::opendir): Always try
	opening with backup intent.
	(fhandler_disk_file::readdir): Ditto when trying to retrieve file id
	explicitely.
	* security.cc (check_file_access): Replace pbuf with correctly
	PPRIVILEGE_SET typed pset.  Check explicitely for backup and/or restore
	privileges when AccessCheck fails, to circumvent AccessCheck
	shortcoming.  Add comment to explain.
This commit is contained in:
Corinna Vinschen
2006-10-16 12:26:59 +00:00
parent 7af26e0cc0
commit 2c1ffdbf5e
5 changed files with 71 additions and 9 deletions

View File

@ -620,13 +620,22 @@ fhandler_base::open (int flags, mode_t mode)
create_options = FILE_OPEN_FOR_BACKUP_INTENT | FILE_OPEN_FOR_RECOVERY;
break;
default:
create_options = 0;
if ((flags & O_ACCMODE) == O_RDONLY)
access = GENERIC_READ;
{
access = GENERIC_READ;
create_options = FILE_OPEN_FOR_BACKUP_INTENT;
}
else if ((flags & O_ACCMODE) == O_WRONLY)
access = GENERIC_WRITE | FILE_READ_ATTRIBUTES;
{
access = GENERIC_WRITE | FILE_READ_ATTRIBUTES;
create_options = FILE_OPEN_FOR_RECOVERY;
}
else
access = GENERIC_READ | GENERIC_WRITE;
{
access = GENERIC_READ | GENERIC_WRITE;
create_options = FILE_OPEN_FOR_BACKUP_INTENT
| FILE_OPEN_FOR_RECOVERY;
}
if (flags & O_SYNC)
create_options |= FILE_WRITE_THROUGH;
if (flags & O_DIRECT)