diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2015-09-03 20:29:55 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2015-11-19 00:44:33 +0300 |
commit | 645913109673c36cebf19d407a6e3e3a4a6288db (patch) | |
tree | f972c23f4d79efcc7da83404c6eef8a690e63e3c /winsup/cygwin/security.cc | |
parent | 4dc3deea8949d830c0a1442023bf1335841d5bcf (diff) |
Fix file type mode bit handling on object security.
* fhandler_tty.cc (fhandler_pty_slave::open): Add S_IFCHR flag
in call to create_object_sd_from_attribute.
(fhandler_pty_slave::fstat): Ditto in call to get_object_attribute.
(fhandler_pty_slave::fchmod): Add an orig_mode flag and ditto for
both calls.
(fhandler_pty_master::setup): Ditto in call to
create_object_sd_from_attribute.
* security.cc (get_object_attribute): Never add S_IFCHR to mode
here. Let the caller decide.
(create_object_sd_from_attribute): Ditto.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin/security.cc')
-rw-r--r-- | winsup/cygwin/security.cc | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc index ac25d71c4..4e02bca2e 100644 --- a/winsup/cygwin/security.cc +++ b/winsup/cygwin/security.cc @@ -401,14 +401,9 @@ get_object_attribute (HANDLE handle, uid_t *uidret, gid_t *gidret, mode_t *attribute) { security_descriptor sd; - mode_t attr = S_IFCHR; if (get_object_sd (handle, sd)) return -1; - if (attribute) - *attribute |= S_IFCHR; - else - attribute = &attr; return get_posix_access (sd, attribute, uidret, gidret, NULL, 0) >= 0 ? 0 : -1; } @@ -417,7 +412,7 @@ int create_object_sd_from_attribute (uid_t uid, gid_t gid, mode_t attribute, security_descriptor &sd) { - return set_posix_access (S_IFCHR | attribute, uid, gid, NULL, 0, sd, false) + return set_posix_access (attribute, uid, gid, NULL, 0, sd, false) ? 0 : -1; } |