diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2003-04-11 09:38:07 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2003-04-11 09:38:07 +0000 |
commit | 2e23862a8a15f4d74fba9ef73d2dc2f84ea8347a (patch) | |
tree | 9a836ac9def09d58ec90e20aa036ba9cfadd3fdc /winsup/cygwin/fhandler_disk_file.cc | |
parent | 4cdc4de239ec04544a9e2adaba32e3e9ddb686b2 (diff) | |
download | cygnal-2e23862a8a15f4d74fba9ef73d2dc2f84ea8347a.tar.gz cygnal-2e23862a8a15f4d74fba9ef73d2dc2f84ea8347a.tar.bz2 cygnal-2e23862a8a15f4d74fba9ef73d2dc2f84ea8347a.zip |
* security.cc (get_info_from_sd): New function.
(get_nt_attribute): Only call read_sd and get_info_from_sd.
Return void.
(get_file_attribute): Move sd error handling to get_info_from_sd.
and symlink handling to fhandler_disk_file::fstat_helper.
(get_nt_object_attribute): Only call read_sd and get_info_from_sd.
Return void.
(get_object_attribute): Remove symlink handling and simply return -1
when ntsec is off.
* fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): For
symlinks set the attribute, call get_file_attribute to get the ids
and return. In the normal case call get_file_attribute with the
addresses of the buffer ids and do not recheck if the file is a socket.
Diffstat (limited to 'winsup/cygwin/fhandler_disk_file.cc')
-rw-r--r-- | winsup/cygwin/fhandler_disk_file.cc | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index ccd725360..9e4de957f 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -281,14 +281,18 @@ fhandler_disk_file::fstat_helper (struct __stat64 *buf, path_conv *pc, if (pc->isdir ()) buf->st_mode = S_IFDIR; else if (pc->issymlink ()) - buf->st_mode = S_IFLNK; + { + /* symlinks are everything for everyone! */ + buf->st_mode = S_IFLNK | S_IRWXU | S_IRWXG | S_IRWXO; + get_file_attribute (pc->has_acls (), get_win32_name (), NULL, + &buf->st_uid, &buf->st_gid); + goto done; + } else if (pc->issocket ()) buf->st_mode = S_IFSOCK; - __uid32_t uid; - __gid32_t gid; if (get_file_attribute (pc->has_acls (), get_win32_name (), &buf->st_mode, - &uid, &gid) == 0) + &buf->st_uid, &buf->st_gid) == 0) { /* If read-only attribute is set, modify ntsec return value */ if (pc->has_attribute (FILE_ATTRIBUTE_READONLY) && !get_symlink_p ()) @@ -309,8 +313,6 @@ fhandler_disk_file::fstat_helper (struct __stat64 *buf, path_conv *pc, buf->st_mode |= S_IFDIR | STD_XBITS; else if (buf->st_mode & S_IFMT) /* nothing */; - else if (pc->issocket ()) - buf->st_mode |= S_IFSOCK; else { buf->st_mode |= S_IFREG; @@ -344,15 +346,12 @@ fhandler_disk_file::fstat_helper (struct __stat64 *buf, path_conv *pc, buf->st_mode |= STD_XBITS; } - buf->st_uid = uid; - buf->st_gid = gid; - /* The number of links to a directory includes the number of subdirectories in the directory, since all those subdirectories point to it. This is too slow on remote drives, so we do without it and set the number of links to 2. */ - + done: syscall_printf ("0 = fstat (, %p) st_atime=%x st_size=%D, st_mode=%p, st_ino=%d, sizeof=%d", buf, buf->st_atime, buf->st_size, buf->st_mode, (int) buf->st_ino, sizeof (*buf)); |