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
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2007-01-07 15:44:10 +0300
committerCorinna Vinschen <corinna@vinschen.de>2007-01-07 15:44:10 +0300
commit6bcc8fd7b1406ec6b5240f1137e0907b28da4f87 (patch)
treec11d5da074c3ad489373fe2984c4e9d0948510ed /winsup/cygwin/sec_acl.cc
parent7ce031f2117085127359d12c518e594ecd7deca8 (diff)
* security.h (setacl): Add parameter for writability flag.
* sec_acl.cc (setacl): Ditto. Set to true if any ACE with write permissions is created. * fhandler_disk_file.cc (fhandler_disk_file::facl): Reset FILE_ATTRIBUTE_READONLY if ACL contains an ACE with write permissions.
Diffstat (limited to 'winsup/cygwin/sec_acl.cc')
-rw-r--r--winsup/cygwin/sec_acl.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/winsup/cygwin/sec_acl.cc b/winsup/cygwin/sec_acl.cc
index 85f02013c..87c6428fe 100644
--- a/winsup/cygwin/sec_acl.cc
+++ b/winsup/cygwin/sec_acl.cc
@@ -1,6 +1,6 @@
/* sec_acl.cc: Sun compatible ACL functions.
- Copyright 2000, 2001, 2002, 2003, 2004 Red Hat, Inc.
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc.
Written by Corinna Vinschen <corinna@vinschen.de>
@@ -44,7 +44,8 @@ searchace (__aclent32_t *aclp, int nentries, int type, __uid32_t id = ILLEGAL_UI
}
int
-setacl (HANDLE handle, const char *file, int nentries, __aclent32_t *aclbufp)
+setacl (HANDLE handle, const char *file, int nentries, __aclent32_t *aclbufp,
+ bool &writable)
{
security_descriptor sd_ret;
@@ -108,6 +109,9 @@ setacl (HANDLE handle, const char *file, int nentries, __aclent32_t *aclbufp)
__seterrno ();
return -1;
}
+
+ writable = false;
+
for (int i = 0; i < nentries; ++i)
{
DWORD allow;
@@ -119,7 +123,10 @@ setacl (HANDLE handle, const char *file, int nentries, __aclent32_t *aclbufp)
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;
+ {
+ allow |= STANDARD_RIGHTS_WRITE | FILE_GENERIC_WRITE;
+ writable = true;
+ }
if (aclbufp[i].a_perm & S_IXOTH)
allow |= FILE_GENERIC_EXECUTE;
if ((aclbufp[i].a_perm & (S_IWOTH | S_IXOTH)) == (S_IWOTH | S_IXOTH))