diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2006-10-16 12:26:59 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2006-10-16 12:26:59 +0000 |
commit | 2c1ffdbf5e6f2767ab63e67834530539d36c6c0b (patch) | |
tree | 52cf8a418ca2727ea55f7918705fa7067275066b /winsup/cygwin/fhandler.cc | |
parent | 7af26e0cc039517e3528ccedee7b778f479104c9 (diff) | |
download | cygnal-2c1ffdbf5e6f2767ab63e67834530539d36c6c0b.tar.gz cygnal-2c1ffdbf5e6f2767ab63e67834530539d36c6c0b.tar.bz2 cygnal-2c1ffdbf5e6f2767ab63e67834530539d36c6c0b.zip |
* 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.
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r-- | winsup/cygwin/fhandler.cc | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 00e987587..672b434e5 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -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) |