delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2003/03/10/10:59:00

Mailing-List: contact cygwin-developers-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT cygwin DOT com>
List-Help: <mailto:cygwin-developers-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-developers-owner AT cygwin DOT com
Delivered-To: mailing list cygwin-developers AT cygwin DOT com
Date: Mon, 10 Mar 2003 16:58:55 +0100
From: Corinna Vinschen <vinschen AT redhat DOT com>
To: "cygwin-developers AT cygwin DOT com" <cygwin-developers AT cygwin DOT com>
Subject: Re: unlink
Message-ID: <20030310155855.GB1193@cygbert.vinschen.de>
Reply-To: cygwin-developers AT cygwin DOT com
Mail-Followup-To: "cygwin-developers AT cygwin DOT com" <cygwin-developers AT cygwin DOT com>
References: <3E6CB0FA DOT 2312CCD0 AT ieee DOT org>
Mime-Version: 1.0
In-Reply-To: <3E6CB0FA.2312CCD0@ieee.org>
User-Agent: Mutt/1.4i

On Mon, Mar 10, 2003 at 10:36:26AM -0500, Pierre A. Humblet wrote:
> So I would propose to remove the DELETE code from alloc_sd and sec_acl
> and to leave unlink as it is, in that respect.

Like this?

Index: sec_acl.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/sec_acl.cc,v
retrieving revision 1.29
diff -p -u -r1.29 sec_acl.cc
--- sec_acl.cc	9 Mar 2003 20:31:07 -0000	1.29
+++ sec_acl.cc	10 Mar 2003 15:52:35 -0000
@@ -119,19 +119,13 @@ setacl (const char *file, int nentries, 
       DWORD allow;
       /* Owner has more standard rights set. */
       if ((aclbufp[i].a_type & ~ACL_DEFAULT) == USER_OBJ)
-	allow = (STANDARD_RIGHTS_ALL & ~DELETE)
-		| FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA;
+	allow = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA;
       else
 	allow = STANDARD_RIGHTS_READ | FILE_READ_ATTRIBUTES | FILE_READ_EA;
       if (aclbufp[i].a_perm & S_IROTH)
 	allow |= FILE_GENERIC_READ;
       if (aclbufp[i].a_perm & S_IWOTH)
-	{
-	  allow |= STANDARD_RIGHTS_WRITE | FILE_GENERIC_WRITE;
-	  /* Owner gets DELETE right, too. */
-	  if ((aclbufp[i].a_type & ~ACL_DEFAULT) == USER_OBJ)
-	    allow |= DELETE;
-	}
+	allow |= STANDARD_RIGHTS_WRITE | FILE_GENERIC_WRITE;
       if (aclbufp[i].a_perm & S_IXOTH)
 	allow |= FILE_GENERIC_EXECUTE;
       if ((aclbufp[i].a_perm & (S_IWOTH | S_IXOTH)) == (S_IWOTH | S_IXOTH))
Index: security.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/security.cc,v
retrieving revision 1.139
diff -p -u -r1.139 security.cc
--- security.cc	9 Mar 2003 20:31:07 -0000	1.139
+++ security.cc	10 Mar 2003 15:52:35 -0000
@@ -1644,12 +1644,12 @@ alloc_sd (__uid32_t uid, __gid32_t gid, 
   int ace_off = 0;
 
   /* Construct allow attribute for owner. */
-  DWORD owner_allow = (STANDARD_RIGHTS_ALL & ~DELETE)
+  DWORD owner_allow = STANDARD_RIGHTS_ALL
 		      | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA;
   if (attribute & S_IRUSR)
     owner_allow |= FILE_GENERIC_READ;
   if (attribute & S_IWUSR)
-    owner_allow |= FILE_GENERIC_WRITE | DELETE;
+    owner_allow |= FILE_GENERIC_WRITE;
   if (attribute & S_IXUSR)
     owner_allow |= FILE_GENERIC_EXECUTE;
   if ((attribute & (S_IFDIR | S_IWUSR | S_IXUSR))


> 2) Why is wincap.has_delete_on_close needed?

Hmm, I can't answer this one.  Historical reasons?  Bad experience?

> 3) I don't understand why there are so many SetFileAttributes after CreateFile
>    succeeds. If the file will be deleted, its attributes are don't care. If it won't,
>    then we undo twice what we just did before the CreateFile.
>    Also it's an easy test to decide if the SetFileAttribute before CreateFile is needed.

Chris and I are through this attribute hell this weekend.  To make it
short:  If the file is hardlinked more than once, the other links would
miss an attribute after removing this one link.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin AT cygwin DOT com
Red Hat, Inc.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019