From 12069cf31bcd401720e1a86b353ac6237b5e29a3 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 26 Nov 2003 13:23:27 +0000 Subject: * 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. --- winsup/cygwin/path.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'winsup/cygwin/path.cc') diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index e938685be..4fe66ac3f 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -2491,6 +2491,7 @@ symlink_worker (const char *topath, const char *frompath, bool use_winsym, char w32topath[CYG_MAX_PATH + 1]; DWORD written; SECURITY_ATTRIBUTES sa = sec_none_nih; + security_descriptor sd; /* POSIX says that empty 'frompath' is invalid input whlie empty 'topath' is valid -- it's symlink resolver job to verify if @@ -2565,7 +2566,7 @@ symlink_worker (const char *topath, const char *frompath, bool use_winsym, if (allow_ntsec && win32_path.has_acls ()) set_security_attribute (S_IFLNK | STD_RBITS | STD_WBITS, - &sa, alloca (4096), 4096); + &sa, sd); h = CreateFile (win32_path, GENERIC_WRITE, 0, &sa, create_how, FILE_ATTRIBUTE_NORMAL, 0); -- cgit v1.2.3