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>2001-08-07 19:09:54 +0400
committerCorinna Vinschen <corinna@vinschen.de>2001-08-07 19:09:54 +0400
commit86fb0393244e5827070e0bb0328a5b40fe5c0268 (patch)
tree8c596fa5f655c6479e1c4bd745cee2522fc35aa6 /winsup/cygwin/path.cc
parentf5e8e2be4a184e8d7f653af19fb62fb576c28d39 (diff)
* dir.cc (mkdir): Set security attributes correctly for
CreateDirectoryA () call if ntsec is on. Don't call set_file_attributes () then. * fhandler.cc (fhandler_base::open): Ditto for CreateFileA () call. * path.cc (symlink): Ditto. * security.cc (set_security_attribute): New function. * security.h: Add declaration for `allow_ntea' and `set_security_attribute'.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r--winsup/cygwin/path.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index bd032d759..65c09525a 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -2395,6 +2395,7 @@ symlink (const char *topath, const char *frompath)
char cwd[MAX_PATH + 1], *cp = NULL, c = 0;
char w32topath[MAX_PATH + 1];
DWORD written;
+ SECURITY_ATTRIBUTES sa = sec_none_nih;
win32_path.check (frompath, PC_SYM_NOFOLLOW);
if (allow_winsymlinks && !win32_path.error)
@@ -2456,7 +2457,11 @@ symlink (const char *topath, const char *frompath)
}
}
- h = CreateFileA(win32_path, GENERIC_WRITE, 0, &sec_none_nih,
+ if (allow_ntsec && win32_path.has_acls ())
+ set_security_attribute (S_IFLNK | S_IRWXU | S_IRWXG | S_IRWXO,
+ &sa, alloca (256), 256);
+
+ h = CreateFileA(win32_path, GENERIC_WRITE, 0, &sa,
CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);
if (h == INVALID_HANDLE_VALUE)
__seterrno ();
@@ -2499,9 +2504,10 @@ symlink (const char *topath, const char *frompath)
if (success)
{
CloseHandle (h);
- set_file_attribute (win32_path.has_acls (),
- win32_path.get_win32 (),
- S_IFLNK | S_IRWXU | S_IRWXG | S_IRWXO);
+ if (!allow_ntsec && allow_ntea)
+ set_file_attribute (win32_path.has_acls (),
+ win32_path.get_win32 (),
+ S_IFLNK | S_IRWXU | S_IRWXG | S_IRWXO);
SetFileAttributesA (win32_path.get_win32 (),
allow_winsymlinks ? FILE_ATTRIBUTE_READONLY
: FILE_ATTRIBUTE_SYSTEM);