aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/external.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2003-11-26 13:23:27 +0000
committerCorinna Vinschen <corinna@vinschen.de>2003-11-26 13:23:27 +0000
commit12069cf31bcd401720e1a86b353ac6237b5e29a3 (patch)
tree1c2de4e70fcc84c84af015ab3fb4349722301d5d /winsup/cygwin/external.cc
parent3db690789f317dc0798bf3dd883a24ebfbb57354 (diff)
downloadnewlib-12069cf31bcd401720e1a86b353ac6237b5e29a3.zip
newlib-12069cf31bcd401720e1a86b353ac6237b5e29a3.tar.gz
newlib-12069cf31bcd401720e1a86b353ac6237b5e29a3.tar.bz2
* 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.
Diffstat (limited to 'winsup/cygwin/external.cc')
-rw-r--r--winsup/cygwin/external.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/winsup/cygwin/external.cc b/winsup/cygwin/external.cc
index fcb2b21..cfe5528 100644
--- a/winsup/cygwin/external.cc
+++ b/winsup/cygwin/external.cc
@@ -268,12 +268,17 @@ cygwin_internal (cygwin_getinfo_types t, ...)
}
case CW_GET_POSIX_SECURITY_ATTRIBUTE:
{
+ security_descriptor sd;
int attribute = va_arg (arg, int);
PSECURITY_ATTRIBUTES psa = va_arg (arg, PSECURITY_ATTRIBUTES);
void *sd_buf = va_arg (arg, void *);
DWORD sd_buf_size = va_arg (arg, DWORD);
- set_security_attribute (attribute, psa, sd_buf, sd_buf_size);
- return psa->lpSecurityDescriptor ? 0 : -1;
+ set_security_attribute (attribute, psa, sd);
+ if (!psa->lpSecurityDescriptor || sd.size () > sd_buf_size)
+ return sd.size ();
+ memcpy (sd_buf, sd, sd.size ());
+ psa->lpSecurityDescriptor = sd_buf;
+ return 0;
}
case CW_GET_SHMLBA:
{