diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2003-11-26 13:52:21 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2003-11-26 13:52:21 +0300 |
commit | 3db690789f317dc0798bf3dd883a24ebfbb57354 (patch) | |
tree | a9f83dd3ca1feada3765eb97a2cd1c7d08686129 /winsup | |
parent | af284c9c3b73619ab3a5e978856b146bd4331511 (diff) |
* sec_acl.h (getace): Use FILE_*_BITS as permission mask.
* security.cc (get_attribute_from_acl): Ditto.
* security.h (FILE_READ_BITS): Define to match also GENERIC bits.
(FILE_WRITE_BITS): Ditto.
(FILE_EXEC_BITS): Ditto.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 8 | ||||
-rw-r--r-- | winsup/cygwin/sec_acl.cc | 6 | ||||
-rw-r--r-- | winsup/cygwin/security.cc | 18 | ||||
-rw-r--r-- | winsup/cygwin/security.h | 4 |
4 files changed, 24 insertions, 12 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index e2bca1571..a07903e29 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,11 @@ +2003-11-26 Corinna Vinschen <corinna@vinschen.de> + + * sec_acl.h (getace): Use FILE_*_BITS as permission mask. + * security.cc (get_attribute_from_acl): Ditto. + * security.h (FILE_READ_BITS): Define to match also GENERIC bits. + (FILE_WRITE_BITS): Ditto. + (FILE_EXEC_BITS): Ditto. + 2003-11-25 Christopher Faylor <cgf@redhat.com> * thread.cc: Minor whitespace cleanup. Remove some obsolete code. diff --git a/winsup/cygwin/sec_acl.cc b/winsup/cygwin/sec_acl.cc index c35891016..0988e01e8 100644 --- a/winsup/cygwin/sec_acl.cc +++ b/winsup/cygwin/sec_acl.cc @@ -235,19 +235,19 @@ getace (__aclent32_t &acl, int type, int id, DWORD win_ace_mask, acl.a_type = type; acl.a_id = id; - if ((win_ace_mask & FILE_READ_DATA) && !(acl.a_perm & (S_IROTH | DENY_R))) + if ((win_ace_mask & FILE_READ_BITS) && !(acl.a_perm & (S_IROTH | DENY_R))) if (win_ace_type == ACCESS_ALLOWED_ACE_TYPE) acl.a_perm |= S_IROTH; else if (win_ace_type == ACCESS_DENIED_ACE_TYPE) acl.a_perm |= DENY_R; - if ((win_ace_mask & FILE_WRITE_DATA) && !(acl.a_perm & (S_IWOTH | DENY_W))) + if ((win_ace_mask & FILE_WRITE_BITS) && !(acl.a_perm & (S_IWOTH | DENY_W))) if (win_ace_type == ACCESS_ALLOWED_ACE_TYPE) acl.a_perm |= S_IWOTH; else if (win_ace_type == ACCESS_DENIED_ACE_TYPE) acl.a_perm |= DENY_W; - if ((win_ace_mask & FILE_EXECUTE) && !(acl.a_perm & (S_IXOTH | DENY_X))) + if ((win_ace_mask & FILE_EXEC_BITS) && !(acl.a_perm & (S_IXOTH | DENY_X))) if (win_ace_type == ACCESS_ALLOWED_ACE_TYPE) acl.a_perm |= S_IXOTH; else if (win_ace_type == ACCESS_DENIED_ACE_TYPE) diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc index 745fa0c5d..448cd6547 100644 --- a/winsup/cygwin/security.cc +++ b/winsup/cygwin/security.cc @@ -1235,15 +1235,15 @@ get_attribute_from_acl (mode_t *attribute, PACL acl, PSID owner_sid, cygpsid ace_sid ((PSID) &ace->SidStart); if (ace_sid == well_known_world_sid) { - if (ace->Mask & FILE_READ_DATA) + if (ace->Mask & FILE_READ_BITS) *flags |= ((!(*anti & S_IROTH)) ? S_IROTH : 0) | ((!(*anti & S_IRGRP)) ? S_IRGRP : 0) | ((!(*anti & S_IRUSR)) ? S_IRUSR : 0); - if (ace->Mask & FILE_WRITE_DATA) + if (ace->Mask & FILE_WRITE_BITS) *flags |= ((!(*anti & S_IWOTH)) ? S_IWOTH : 0) | ((!(*anti & S_IWGRP)) ? S_IWGRP : 0) | ((!(*anti & S_IWUSR)) ? S_IWUSR : 0); - if (ace->Mask & FILE_EXECUTE) + if (ace->Mask & FILE_EXEC_BITS) *flags |= ((!(*anti & S_IXOTH)) ? S_IXOTH : 0) | ((!(*anti & S_IXGRP)) ? S_IXGRP : 0) | ((!(*anti & S_IXUSR)) ? S_IXUSR : 0); @@ -1264,22 +1264,22 @@ get_attribute_from_acl (mode_t *attribute, PACL acl, PSID owner_sid, } else if (ace_sid == owner_sid) { - if (ace->Mask & FILE_READ_DATA) + if (ace->Mask & FILE_READ_BITS) *flags |= ((!(*anti & S_IRUSR)) ? S_IRUSR : 0); - if (ace->Mask & FILE_WRITE_DATA) + if (ace->Mask & FILE_WRITE_BITS) *flags |= ((!(*anti & S_IWUSR)) ? S_IWUSR : 0); - if (ace->Mask & FILE_EXECUTE) + if (ace->Mask & FILE_EXEC_BITS) *flags |= ((!(*anti & S_IXUSR)) ? S_IXUSR : 0); } else if (ace_sid == group_sid) { - if (ace->Mask & FILE_READ_DATA) + if (ace->Mask & FILE_READ_BITS) *flags |= ((!(*anti & S_IRGRP)) ? S_IRGRP : 0) | ((grp_member && !(*anti & S_IRUSR)) ? S_IRUSR : 0); - if (ace->Mask & FILE_WRITE_DATA) + if (ace->Mask & FILE_WRITE_BITS) *flags |= ((!(*anti & S_IWGRP)) ? S_IWGRP : 0) | ((grp_member && !(*anti & S_IWUSR)) ? S_IWUSR : 0); - if (ace->Mask & FILE_EXECUTE) + if (ace->Mask & FILE_EXEC_BITS) *flags |= ((!(*anti & S_IXGRP)) ? S_IXGRP : 0) | ((grp_member && !(*anti & S_IXUSR)) ? S_IXUSR : 0); } diff --git a/winsup/cygwin/security.h b/winsup/cygwin/security.h index e8e4f4745..f50599adf 100644 --- a/winsup/cygwin/security.h +++ b/winsup/cygwin/security.h @@ -23,6 +23,10 @@ details. */ #define ACL_DEFAULT_SIZE 3072 #define NO_SID ((PSID)NULL) +#define FILE_READ_BITS (FILE_READ_DATA | GENERIC_READ | GENERIC_ALL) +#define FILE_WRITE_BITS (FILE_WRITE_DATA | GENERIC_WRITE | GENERIC_ALL) +#define FILE_EXEC_BITS (FILE_EXECUTE | GENERIC_EXECUTE | GENERIC_ALL) + class cygpsid { protected: PSID psid; |