diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2014-08-27 11:42:17 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2014-08-27 11:42:17 +0000 |
commit | 326510785e2fd6d2025e5b3a257748b1fa725271 (patch) | |
tree | 79fe2eb589c73fdc3f21c9dd2dd8cd65f548f52a /winsup/cygwin/fhandler_tty.cc | |
parent | 37579836e3e9538a8ca92b07debcdb612f5021af (diff) | |
download | cygnal-326510785e2fd6d2025e5b3a257748b1fa725271.tar.gz cygnal-326510785e2fd6d2025e5b3a257748b1fa725271.tar.bz2 cygnal-326510785e2fd6d2025e5b3a257748b1fa725271.zip |
* fhandler.h (fhandler_pty_slave::fch_open_handles): Add bool parameter
to declaration.
* fhandler_tty.cc (fhandler_pty_slave::fch_open_handles): Add bool
parameter "chown". Only request WRITE_OWNER access when opening pty
synchronization objects if "chown" is set.
(fhandler_pty_slave::fchmod): Call fch_open_handles with new bool
parameter set to false.
(fhandler_pty_slave::fchown): Call fch_open_handles with new bool
parameter set to true.
* kernel32.cc (CreateFileMappingW): Fix default standard rights for
file mappings from READ_CONTROL to STANDARD_RIGHTS_REQUIRED to allow
changing the DACL (fixes "access denied" error in pinfo::set_acl).
* fhandler_disk_file.cc (fhandler_base::fstat_helper): Change debug
output to print mode bits in octal.
* security.cc (alloc_sd): Ditto.
(set_file_attribute): Ditto.
Diffstat (limited to 'winsup/cygwin/fhandler_tty.cc')
-rw-r--r-- | winsup/cygwin/fhandler_tty.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 9d928bd64..eea635f89 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -1102,17 +1102,18 @@ fhandler_pty_slave::fstat (struct stat *st) /* Helper function for fchmod and fchown, which just opens all handles and signals success via bool return. */ bool -fhandler_pty_slave::fch_open_handles () +fhandler_pty_slave::fch_open_handles (bool chown) { char buf[MAX_PATH]; + DWORD write_access = WRITE_DAC | (chown ? WRITE_OWNER : 0); _tc = cygwin_shared->tty[get_minor ()]; shared_name (buf, INPUT_AVAILABLE_EVENT, get_minor ()); - input_available_event = OpenEvent (READ_CONTROL | WRITE_DAC | WRITE_OWNER, + input_available_event = OpenEvent (READ_CONTROL | write_access, TRUE, buf); - output_mutex = get_ttyp ()->open_output_mutex (WRITE_DAC | WRITE_OWNER); - input_mutex = get_ttyp ()->open_input_mutex (WRITE_DAC | WRITE_OWNER); - inuse = get_ttyp ()->open_inuse (WRITE_DAC | WRITE_OWNER); + output_mutex = get_ttyp ()->open_output_mutex (write_access); + input_mutex = get_ttyp ()->open_input_mutex (write_access); + inuse = get_ttyp ()->open_inuse (write_access); if (!input_available_event || !output_mutex || !input_mutex || !inuse) { __seterrno (); @@ -1166,7 +1167,7 @@ fhandler_pty_slave::fchmod (mode_t mode) if (!input_available_event) { to_close = true; - if (!fch_open_handles ()) + if (!fch_open_handles (false)) goto errout; } sd.malloc (sizeof (SECURITY_DESCRIPTOR)); @@ -1195,7 +1196,7 @@ fhandler_pty_slave::fchown (uid_t uid, gid_t gid) if (!input_available_event) { to_close = true; - if (!fch_open_handles ()) + if (!fch_open_handles (true)) goto errout; } sd.malloc (sizeof (SECURITY_DESCRIPTOR)); |