diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2000-03-16 19:35:18 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2000-03-16 19:35:18 +0000 |
commit | 5d4af61e5d20cb18f7b3276f4af080e2e0c9c619 (patch) | |
tree | 1f59bb15ee8cd13432c9eaf4810fd5563a7032aa /winsup/cygwin/fhandler.cc | |
parent | 6bc4ac717b435a6dc491ffc6f942dfd84c59232a (diff) | |
download | cygnal-5d4af61e5d20cb18f7b3276f4af080e2e0c9c619.tar.gz cygnal-5d4af61e5d20cb18f7b3276f4af080e2e0c9c619.tar.bz2 cygnal-5d4af61e5d20cb18f7b3276f4af080e2e0c9c619.zip |
* security.cc (set_process_privileges): Removed `static'.
(get_nt_attribute): Returns uid and gid additionally. Removed call
to set_process_privileges().
(get_file_attribute): Returns uid and gid additionally. Don't
call ntea if ntsec is ON.
(set_nt_attribute): Removed call to set_process_privileges().
Don't call ntea if ntsec is ON.
(acl): Removed call to set_process_privileges().
* dcrt0.cc (dll_crt0_1): Calls set_process_privileges() now.
* winsup.h: New prototype for set_process_privileges(),
changed prototype for get_file_attribute().
* fhandler.cc (get_file_owner): Discarded.
(get_file_group): Ditto.
(fhandler_disk_file::fstat): Discard calls to get_file_owner() and
get_file_group().
* path.cc (path_conv::path_conv): Added debugging output for result
of GetVolumeInformation().
(mount_info::conv_to_win32_path): Call backslashify() with pathbuf
instead of src_path.
* syscalls.cc (chown): Reformatted.
(chmod): Replace get_file_owner() and get_file_group() calls
by a call to get_file_attribute(). Discard local variable has_acls.
Slightly reformatted.
(stat_worker): Replaced idiot's (it's me) root dir check by call
to rootdir(). Don't call num_entries() on remote drives.
Discard local variable has_acls.
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r-- | winsup/cygwin/fhandler.cc | 56 |
1 files changed, 5 insertions, 51 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index c3219aa7c..2aba80d7f 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -114,54 +114,6 @@ fhandler_base::get_readahead_into_buffer (char *buf, size_t buflen) return copied_chars; } -uid_t __stdcall -get_file_owner (int use_ntsec, const char *filename) -{ - if (use_ntsec && allow_ntsec) - { - extern LONG ReadSD(const char *, PSECURITY_DESCRIPTOR, LPDWORD); - DWORD sd_size = 4096; - char psd_buffer[4096]; - PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR) psd_buffer; - PSID psid; - BOOL bOwnerDefaulted = TRUE; - - if (ReadSD (filename, psd, &sd_size) <= 0) - return getuid(); - - if (!GetSecurityDescriptorOwner (psd, &psid, &bOwnerDefaulted)) - return getuid (); - - return psid ? get_uid_from_sid (psid) : getuid (); - } - - return getuid(); -} - -gid_t __stdcall -get_file_group (int use_ntsec, const char *filename) -{ - if (use_ntsec && allow_ntsec) - { - extern LONG ReadSD(const char *, PSECURITY_DESCRIPTOR, LPDWORD); - DWORD sd_size = 4096; - char psd_buffer[4096]; - PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR) psd_buffer; - PSID psid; - BOOL bGroupDefaulted = TRUE; - - if (ReadSD (filename, psd, &sd_size) <= 0) - return getgid(); - - if (!GetSecurityDescriptorGroup (psd, &psid, &bGroupDefaulted)) - return getgid (); - - return psid ? get_gid_from_sid (psid) : getuid (); - } - - return getgid (); -} - /**********************************************************************/ /* fhandler_base */ @@ -959,14 +911,16 @@ fhandler_disk_file::fstat (struct stat *buf) buf->st_blksize = S_BLKSIZE; buf->st_blocks = (buf->st_size + S_BLKSIZE-1) / S_BLKSIZE; - buf->st_uid = get_file_owner (has_acls (), get_win32_name ()); - buf->st_gid = get_file_group (has_acls (), get_win32_name ()); /* Using a side effect: get_file_attibutes checks for directory. This is used, to set S_ISVTX, if needed. */ if (local.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) buf->st_mode |= S_IFDIR; - if (! get_file_attribute (has_acls (), get_win32_name (), &buf->st_mode)) + if (! get_file_attribute (has_acls (), + get_win32_name (), + &buf->st_mode, + &buf->st_uid, + &buf->st_gid)) { /* If read-only attribute is set, modify ntsec return value */ if (local.dwFileAttributes & FILE_ATTRIBUTE_READONLY) |