aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/path.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2008-08-14 14:05:04 +0000
committerCorinna Vinschen <corinna@vinschen.de>2008-08-14 14:05:04 +0000
commit88797e5979c906e8bb5b181e4c2511b8b79b5818 (patch)
tree1c40f694b610a1aa5330c429febb9adc68416662 /winsup/cygwin/path.cc
parent56d81795705a67bef7e1e5fa934a2109e34b316f (diff)
downloadnewlib-88797e5979c906e8bb5b181e4c2511b8b79b5818.zip
newlib-88797e5979c906e8bb5b181e4c2511b8b79b5818.tar.gz
newlib-88797e5979c906e8bb5b181e4c2511b8b79b5818.tar.bz2
* external.cc (cygwin_internal): Call set_security_attribute with
additional path_conv argument. * fhandler.cc (fhandler_base::open): Ditto. * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Never set DOS R/O attribute when using ACLs. (fhandler_disk_file::mkdir): Ditto. Set security descriptor on remote dirs after creating the dir, same as in fhandler_base::open. * fhandler_socket.cc (fhandler_socket::bind): Ditto for remote AF_LOCAL socket files. * path.cc (symlink_worker): Ditto. for remote symlinks. * security.cc (alloc_sd): Take additional path_conv argument. Accommodate throughout. Drop setting FILE_WRITE_EA/FILE_READ_EA flags unconditionally (was only necessary for "ntea"). Don't set FILE_READ_ATTRIBUTES and FILE_WRITE_ATTRIBUTES unconditionally on Samba. Add comment to explain. Drop useless setting of STANDARD_RIGHTS_WRITE, it's in FILE_GENERIC_WRITE anyway. Remove FILE_READ_ATTRIBUTES bit from FILE_GENERIC_EXECUTE so as not to enforce read permissions on Samba. (set_security_attribute): Take additional path_conv argument. * security.h (set_security_attribute): Change prototype accordingly.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r--winsup/cygwin/path.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 64d8759..4a91ff8 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1766,8 +1766,10 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
goto done;
}
}
- if (win32_newpath.has_acls ())
- set_security_attribute (S_IFLNK | STD_RBITS | STD_WBITS,
+ /* See comments in fhander_base::open () for an explanation why we defer
+ setting security attributes on remote files. */
+ if (win32_newpath.has_acls () && !win32_newpath.isremote ())
+ set_security_attribute (win32_newpath, S_IFLNK | STD_RBITS | STD_WBITS,
&sa, sd);
status = NtCreateFile (&fh, DELETE | FILE_GENERIC_WRITE,
win32_newpath.get_object_attr (attr, sa),
@@ -1783,6 +1785,9 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
__seterrno_from_nt_status (status);
goto done;
}
+ if (win32_newpath.has_acls () && win32_newpath.isremote ())
+ set_file_attribute (fh, win32_newpath, ILLEGAL_UID, ILLEGAL_GID,
+ S_IFLNK | STD_RBITS | STD_WBITS);
status = NtWriteFile (fh, NULL, NULL, NULL, &io, buf, cp - buf, NULL, NULL);
if (NT_SUCCESS (status) && io.Information == (ULONG) (cp - buf))
{