Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2012-03-02 21:07:17 +0400
committerCorinna Vinschen <corinna@vinschen.de>2012-03-02 21:07:17 +0400
commitb4ad7197fb1ad7dccdab927b93b52a5128cd293f (patch)
treeb790aa6ce6fd3e47b81ce1efaa999ab9dc4314b1 /winsup/cygwin/flock.cc
parent52cbb05cfb0556653faa1f4e06a5ede5c80b2c81 (diff)
* flock.cc (allow_others_to_sync): Use RtlGetDaclSecurityDescriptor
rather than accessing the SECURITY_DESCRIPTOR structure directly. Take no DACL and NULL DACL into account.
Diffstat (limited to 'winsup/cygwin/flock.cc')
-rw-r--r--winsup/cygwin/flock.cc18
1 files changed, 16 insertions, 2 deletions
diff --git a/winsup/cygwin/flock.cc b/winsup/cygwin/flock.cc
index a4d28e5f6..c66891a35 100644
--- a/winsup/cygwin/flock.cc
+++ b/winsup/cygwin/flock.cc
@@ -176,8 +176,22 @@ allow_others_to_sync ()
/* Create a valid dacl pointer and set its size to be as big as
there's room in the temporary buffer. Note that the descriptor
is in self-relative format. */
- dacl = (PACL) ((char *) sd + (uintptr_t) sd->Dacl);
- dacl->AclSize = NT_MAX_PATH * sizeof (WCHAR) - ((char *) dacl - (char *) sd);
+ BOOLEAN present, defaulted;
+ RtlGetDaclSecurityDescriptor (sd, &present, &dacl, &defaulted);
+ if (dacl == NULL) /* Everyone has all access anyway */
+ {
+ done = true;
+ return;
+ }
+ else if (!present)
+ {
+ dacl = (PACL) (sd + 1);
+ RtlCreateAcl (dacl, MAX_PROCESS_SD_SIZE - sizeof *sd, ACL_REVISION);
+ }
+ else
+ {
+ dacl->AclSize = MAX_PROCESS_SD_SIZE - ((PBYTE) dacl - (PBYTE) sd);
+ }
/* Allow everyone to SYNCHRONIZE with this process. */
status = RtlAddAccessAllowedAce (dacl, ACL_REVISION, SYNCHRONIZE,
well_known_world_sid);