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
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2015-11-10 12:00:33 +0300
committerCorinna Vinschen <corinna@vinschen.de>2015-11-19 00:56:38 +0300
commit90e006a63dd9594c5d05b7251e27d16bceab3cac (patch)
tree99b16cd4b0d6fb69d5e25ecee67832813351c8a7 /winsup
parenta5d81afc71440ff782890abf1cf0986d724f42ac (diff)
get_posix_access: Skip merging permissions if user can't get more permissions
* sec_acl.cc (get_posix_access): Skip merging permissions if current user has rwx permissions anywa, or if the sum of all group and other permissions is less than or equal to the user's permissions. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/sec_acl.cc13
2 files changed, 17 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 449112319..49bac71e6 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,11 @@
2015-11-18 Corinna Vinschen <corinna@vinschen.de>
+ * sec_acl.cc (get_posix_access): Skip merging permissions if current
+ user has rwx permissions anywa, or if the sum of all group and other
+ permissions is less than or equal to the user's permissions.
+
+2015-11-18 Corinna Vinschen <corinna@vinschen.de>
+
* sec_acl.cc (get_posix_access): Fix computation of effective user
permissions to handle current user, not only the file owner.
diff --git a/winsup/cygwin/sec_acl.cc b/winsup/cygwin/sec_acl.cc
index a9e1dea5f..f632410ee 100644
--- a/winsup/cygwin/sec_acl.cc
+++ b/winsup/cygwin/sec_acl.cc
@@ -1019,8 +1019,17 @@ get_posix_access (PSECURITY_DESCRIPTOR psd,
{
mode_t perm;
- /* If we use the Windows user DB, utilize Authz to make sure all
- user permissions are correctly reflecting the Windows
+ /* Don't merge if the user already has all permissions, or... */
+ if (lacl[idx].a_perm == S_IRWXO)
+ continue;
+ /* ...if the sum of perms is less than or equal the user's perms. */
+ perm = lacl[idx].a_perm
+ | (has_class_perm ? class_perm : lacl[1].a_perm)
+ | lacl[2].a_perm;
+ if (perm == lacl[idx].a_perm)
+ continue;
+ /* Otherwise, if we use the Windows user DB, utilize Authz to make
+ sure all user permissions are correctly reflecting the Windows
permissions. */
if (cygheap->pg.nss_pwd_db ()
&& authz_get_user_attribute (&perm, psd, aclsid[idx]))