From 115d74b99e5beba493bff58384d0d167bcaf77c3 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sun, 3 Jun 2012 16:46:53 +0000 Subject: * globals.cc (ro_u_refs): New R/O unicode string. * mount.cc (fs_info::update): Recognize ReFS. * mount.h (enum fs_info_type): Add refs. (class fs_info): Add refs flag and accessor methods. * ntdll.h (RtlAddAccessAllowedAceEx): Declare. (RtlAddAccessDeniedAceEx): Declare. * path.h (path_conv::fs_is_refs): Define. * sec_helper.cc (_recycler_sd): New function to create security descriptors suitable for the recycler bin starting with Vista. * security.cc (add_access_allowed_ace): Use RtlAddAccessAllowedAceEx and drop code to set AceFlags explicitely. (add_access_denied_ace): Use RtlAddAccessDeniedAceEx and drop code to set AceFlags explicitely. * security.h (_recycler_sd): Declare. (recycler_sd): Define. * syscalls.cc (desktop_ini): Change formatting. (desktop_ini_ext): Define third line of recycler desktop.ini file since Vista, (try_to_bin): Handle ReFS just like NTFS. Write Vista and later Recycler in all uppercase, just like shell32 does when recreating it. Fix comments to include ReFS. Don't implicitely reuse object attributes from earlier NtOpenFile call, rather recreate it for safety. Use recycler_sd call when creating security descriptor for Recycler dirs and files on Vista and later. Write third line of desktop.ini when on Vista and later. --- winsup/cygwin/security.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'winsup/cygwin/security.cc') diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc index 3afd2b458..cf3888bd3 100644 --- a/winsup/cygwin/security.cc +++ b/winsup/cygwin/security.cc @@ -1,7 +1,7 @@ /* security.cc: NT file access control functions Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2007, 2008, 2009, 2010, 2011 Red Hat, Inc. + 2006, 2007, 2008, 2009, 2010, 2011, 2012 Red Hat, Inc. Originaly written by Gunther Ebert, gunther.ebert@ixos-leipzig.de Completely rewritten by Corinna Vinschen @@ -469,15 +469,13 @@ bool add_access_allowed_ace (PACL acl, int offset, DWORD attributes, PSID sid, size_t &len_add, DWORD inherit) { - NTSTATUS status = RtlAddAccessAllowedAce (acl, ACL_REVISION, attributes, sid); + NTSTATUS status = RtlAddAccessAllowedAceEx (acl, ACL_REVISION, inherit, + attributes, sid); if (!NT_SUCCESS (status)) { __seterrno_from_nt_status (status); return false; } - ACCESS_ALLOWED_ACE *ace; - if (inherit && NT_SUCCESS (RtlGetAce (acl, offset, (PVOID *) &ace))) - ace->Header.AceFlags |= inherit; len_add += sizeof (ACCESS_ALLOWED_ACE) - sizeof (DWORD) + RtlLengthSid (sid); return true; } @@ -486,15 +484,13 @@ bool add_access_denied_ace (PACL acl, int offset, DWORD attributes, PSID sid, size_t &len_add, DWORD inherit) { - NTSTATUS status = RtlAddAccessDeniedAce (acl, ACL_REVISION, attributes, sid); + NTSTATUS status = RtlAddAccessDeniedAceEx (acl, ACL_REVISION, inherit, + attributes, sid); if (!NT_SUCCESS (status)) { __seterrno_from_nt_status (status); return false; } - ACCESS_DENIED_ACE *ace; - if (inherit && NT_SUCCESS (RtlGetAce (acl, offset, (PVOID *) &ace))) - ace->Header.AceFlags |= inherit; len_add += sizeof (ACCESS_DENIED_ACE) - sizeof (DWORD) + RtlLengthSid (sid); return true; } -- cgit v1.2.3