* autoload.cc (NtCreateFile): Add.

* dir.cc (mkdir): Change set_file_attribute call to indicate that
	NT security isn't used.
	* fhandler.cc (fhandler_base::open_9x): New method, created from
	fhandler_base::open.
	(fhandler_base::open): Rearrange to use NtCreateFile instead of
	CreateFile.
	* fhandler.h (enum query_state): Redefine query_null_access to
	query_stat_control.  query_null_access isn't allowed in NtCreateFile.
	(fhandler_base::open_9x): Declare.
	* fhandler_disk_file.cc (fhandler_base::fstat_fs): Use
	query_stat_control first, query_read_control if that fails.
	(fhandler_disk_file::fchmod): Call enable_restore_privilege before
	trying to open for query_write_control.  Don't fall back to
	opening for query_read_control.
	(fhandler_disk_file::fchown): Ditto.
	(fhandler_disk_file::facl):  Only request restore privilege and query
	access necessary for given cmd.
	* fhandler_raw.cc (fhandler_dev_raw::open): Call fhandler_base::open
	instead of opening device here.
	* ntdll.h (NtCreateFile): Declare.
	* path.cc (symlink_worker): Change set_file_attribute call to indicate
	that NT security isn't used.
	* sec_acl.cc (getacl): Fix bracketing.
	* sec_helper.cc (enable_restore_privilege): New function.
	* security.cc (str2buf2uni_cat): New function.
	(write_sd): Don't request restore permission here.
	* security.h (set_process_privileges): Drop stale declaration.
	(str2buf2uni): Declare.
	(str2buf2uni_cat): Declare.
	(enable_restore_privilege): Declare.
	* syscalls.cc (fchown32): Return immediate success on 9x.
This commit is contained in:
Corinna Vinschen
2004-04-16 21:22:13 +00:00
parent e2c248c18b
commit e859706578
14 changed files with 293 additions and 144 deletions

View File

@ -144,41 +144,16 @@ fhandler_dev_raw::open (int flags, mode_t)
flags &= ~(O_CREAT | O_TRUNC);
flags |= O_BINARY;
DWORD access = GENERIC_READ | SYNCHRONIZE;
if (get_major () == DEV_TAPE_MAJOR
|| (flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_WRONLY
|| (flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_RDWR)
access |= GENERIC_WRITE;
flags = ((flags & ~(O_WRONLY | O_RDWR)) | O_RDWR);
extern void str2buf2uni (UNICODE_STRING &, WCHAR *, const char *);
UNICODE_STRING dev;
WCHAR devname[CYG_MAX_PATH + 1];
str2buf2uni (dev, devname, get_win32_name ());
OBJECT_ATTRIBUTES attr;
ULONG options = FILE_SYNCHRONOUS_IO_NONALERT;
/* The O_TEXT flag is used to indicate write-through on tape devices */
if (get_major () == DEV_TAPE_MAJOR && (flags & O_TEXT))
options |= FILE_WRITE_THROUGH;
flags &= ~O_TEXT;
InitializeObjectAttributes (&attr, &dev, OBJ_CASE_INSENSITIVE, NULL, NULL);
HANDLE h;
IO_STATUS_BLOCK io;
NTSTATUS status = NtOpenFile (&h, access, &attr, &io, 0 /* excl. access */,
options);
if (!NT_SUCCESS (status))
{
__seterrno_from_win_error (RtlNtStatusToDosError (status));
return 0;
}
set_io_handle (h);
set_flags ((flags & ~O_TEXT) | O_BINARY);
if (devbufsiz > 1L)
int res = fhandler_base::open (flags, 0);
if (res && devbufsiz > 1L)
devbuf = new char [devbufsiz];
return 1;
return res;
}
int