public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/main] Cygwin: get_posix_access: do not merge permissions for just created files
@ 2023-07-21 19:58 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2023-07-21 19:58 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=971d2dffea7848270aa9dfb5c14dcd946c8971c0

commit 971d2dffea7848270aa9dfb5c14dcd946c8971c0
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Fri Jul 21 21:49:54 2023 +0200
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Fri Jul 21 21:57:44 2023 +0200

    Cygwin: get_posix_access: do not merge permissions for just created files
    
    When creating the POSIX ACL rewrite, the code merging permissions from
    everyone/group to group/user ACEs was accidentally called for newly
    generated files as well.
    
    This could result in broken permissions, if umask used unusual values
    like "0100", granted permissions to everyone/group not granted to
    group/user.
    
    Make sure to skip permission merging if the file got just created and
    we only want to set correct permissions for the first time.
    
    Fixes: bc444e5aa4ca ("Reapply POSIX ACL changes.")
    Reported-by: Jon Turney <jon.turney@dronecode.org.uk>
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/sec/acl.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/sec/acl.cc b/winsup/cygwin/sec/acl.cc
index 2fd08ad62579..db86f9e9e023 100644
--- a/winsup/cygwin/sec/acl.cc
+++ b/winsup/cygwin/sec/acl.cc
@@ -1103,7 +1103,7 @@ get_posix_access (PSECURITY_DESCRIPTOR psd,
     pos = MAX_ACL_ENTRIES;
 
   /* For old-style or non-Cygwin ACLs, check for merging permissions. */
-  if (!new_style)
+  if (!just_created && !new_style)
     for (idx = 0; idx < pos; ++idx)
       {
 	if (lacl[idx].a_type & (USER_OBJ | USER)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-07-21 19:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-21 19:58 [newlib-cygwin/main] Cygwin: get_posix_access: do not merge permissions for just created files Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).