public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin/main] Cygwin: get_posix_access: do not merge permissions for just created files
Date: Fri, 21 Jul 2023 19:58:44 +0000 (GMT)	[thread overview]
Message-ID: <20230721195844.0F096385B53C@sourceware.org> (raw)

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)

                 reply	other threads:[~2023-07-21 19:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230721195844.0F096385B53C@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).