* w32.c (acl_set_file): Treat ERROR_ACCESS_DENIED from
set_file_security as failure due to insufficient privileges.
Reported by Fabrice Popineau <fabrice.popineau@supelec.fr>.
+ (fstat): Return owner and group like 'stat' and 'lstat' do.
2013-01-19 Paul Eggert <eggert@cs.ucla.edu>
else
buf->st_ino = fake_inode;
- /* Consider files to belong to current user.
- FIXME: this should use GetSecurityInfo API, but it is only
- available for _WIN32_WINNT >= 0x501. */
- buf->st_uid = dflt_passwd.pw_uid;
- buf->st_gid = dflt_passwd.pw_gid;
- strcpy (buf->st_uname, dflt_passwd.pw_name);
- strcpy (buf->st_gname, dflt_group.gr_name);
+ /* If the caller so requested, get the true file owner and group.
+ Otherwise, consider the file to belong to the current user. */
+ if (!w32_stat_get_owner_group || is_windows_9x () == TRUE)
+ get_file_owner_and_group (NULL, buf);
+ else
+ {
+ PSECURITY_DESCRIPTOR psd = NULL;
+
+ psd = get_file_security_desc_by_handle (fh);
+ if (psd)
+ {
+ get_file_owner_and_group (psd, buf);
+ LocalFree (psd);
+ }
+ else
+ get_file_owner_and_group (NULL, buf);
+ }
buf->st_dev = info.dwVolumeSerialNumber;
buf->st_rdev = info.dwVolumeSerialNumber;