* dir.cc (mkdir): Use local security_descriptor. Call
set_security_attribute appropriately. * external.cc (cygwin_internal): Ditto. * fhandler.cc (fhandler_base::open): Ditto. * fhandler_socket.cc (fhandler_socket::bind): Ditto. * path.cc (symlink_worker): Ditto. * sec_acl.cc (setacl): Ditto. Call read_sd appropriately. (getace): Ditto. * sec_helper.cc (security_descriptor::malloc): New method. (security_descriptor::realloc): New method. (security_descriptor::free): New method. * security.cc (read_sd): Get security_descriptor as parameter instead of PSECURITY_DESCRIPTOR and a size. Drop unnecessary parameter check. Allocate the security_descriptor buffer according to size returned by a call to GetFileSecurity. Return buffer size on success. (write_sd): Get security_descriptor as parameter instead of PSECURITY_DESCRIPTOR and a size. (get_nt_attribute): Use local security_descriptor. (get_nt_object_attribute): Ditto in case of type == SE_REGISTRY_KEY. Allocate security_descriptor buffer according to size returned by a call to RegGetKeySecurity. (alloc_sd): Make static. Get security_descriptor as parameter instead of PSECURITY_DESCRIPTOR and a size. Drop unnecessary parameter check. (set_security_attribute): Get security_descriptor as parameter instead of PSECURITY_DESCRIPTOR and a size. (set_nt_attribute): Use local security_descriptor. (check_file_access): Ditto. * security.h: Add class security_descriptor. (read_sd): Change declaration to get security_descriptor as parameter instead of PSECURITY_DESCRIPTOR and a size. (write_sd): Ditto. (set_security_attribute): Ditto. (alloc_sd): Remove declaration. * thread.cc (semaphore::semaphore): Use local security_descriptor. Call set_security_attribute appropriately.
This commit is contained in:
@ -342,6 +342,7 @@ fhandler_base::open (int flags, mode_t mode)
|
||||
int shared;
|
||||
int creation_distribution;
|
||||
SECURITY_ATTRIBUTES sa = sec_none;
|
||||
security_descriptor sd;
|
||||
|
||||
syscall_printf ("(%s, %p) query_open %d", get_win32_name (), flags, get_query_open ());
|
||||
|
||||
@ -421,7 +422,7 @@ fhandler_base::open (int flags, mode_t mode)
|
||||
/* If the file should actually be created and ntsec is on,
|
||||
set files attributes. */
|
||||
if (flags & O_CREAT && get_device () == FH_FS && allow_ntsec && has_acls ())
|
||||
set_security_attribute (mode, &sa, alloca (4096), 4096);
|
||||
set_security_attribute (mode, &sa, sd);
|
||||
|
||||
x = CreateFile (get_win32_name (), access, shared, &sa, creation_distribution,
|
||||
file_attributes, 0);
|
||||
|
Reference in New Issue
Block a user