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>2014-08-27 15:42:17 +0400
committerCorinna Vinschen <corinna@vinschen.de>2014-08-27 15:42:17 +0400
commit326510785e2fd6d2025e5b3a257748b1fa725271 (patch)
tree79fe2eb589c73fdc3f21c9dd2dd8cd65f548f52a /winsup/cygwin
parent37579836e3e9538a8ca92b07debcdb612f5021af (diff)
* 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')
-rw-r--r--winsup/cygwin/ChangeLog14
-rw-r--r--winsup/cygwin/fhandler.h2
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc2
-rw-r--r--winsup/cygwin/fhandler_tty.cc15
-rw-r--r--winsup/cygwin/security.cc4
5 files changed, 26 insertions, 11 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 22f144b49..913738861 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,9 +1,23 @@
2014-08-27 Corinna Vinschen <corinna@vinschen.de>
+ * 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.
+
2014-08-27 Corinna Vinschen <corinna@vinschen.de>
* ntea.cc (read_ea): Change left-over return to __leave. Fix
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 173e531ba..cf4de0746 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -1506,7 +1506,7 @@ class fhandler_pty_slave: public fhandler_pty_common
HANDLE inuse; // used to indicate that a tty is in use
/* Helper functions for fchmod and fchown. */
- bool fch_open_handles ();
+ bool fch_open_handles (bool chown);
int fch_set_sd (security_descriptor &sd, bool chown);
void fch_close_handles ();
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index 98475e5d9..d71300268 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -714,7 +714,7 @@ fhandler_base::fstat_helper (struct stat *buf, DWORD nNumberOfLinks)
}
done:
- syscall_printf ("0 = fstat (%S, %p) st_size=%D, st_mode=%y, st_ino=%D"
+ syscall_printf ("0 = fstat (%S, %p) st_size=%D, st_mode=0%o, st_ino=%D"
"st_atim=%lx.%lx st_ctim=%lx.%lx "
"st_mtim=%lx.%lx st_birthtim=%lx.%lx",
pc.get_nt_native_path (), buf,
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));
diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc
index becc3fef6..af89a5238 100644
--- a/winsup/cygwin/security.cc
+++ b/winsup/cygwin/security.cc
@@ -506,7 +506,7 @@ alloc_sd (path_conv &pc, uid_t uid, gid_t gid, int attribute,
/* NOTE: If the high bit of attribute is set, we have just created
a file or directory. See below for an explanation. */
- debug_printf("uid %u, gid %u, attribute %y", uid, gid, attribute);
+ debug_printf("uid %u, gid %u, attribute 0%o", uid, gid, attribute);
/* Get owner and group from current security descriptor. */
PSID cur_owner_sid = NULL;
@@ -964,7 +964,7 @@ set_file_attribute (HANDLE handle, path_conv &pc,
}
else
ret = 0;
- syscall_printf ("%d = set_file_attribute(%S, %d, %d, %y)",
+ syscall_printf ("%d = set_file_attribute(%S, %d, %d, 0%o)",
ret, pc.get_nt_native_path (), uid, gid, attribute);
return ret;
}