+2012-12-18 Eli Zaretskii <eliz@gnu.org>
+
+ * w32.c (acl_get_file, acl_set_file): Run the file name through
+ map_w32_filename, and resolve any symlinks in the file name, like
+ Posix platforms do.
+ (acl_set_file): Call revert_to_self, if any privileges were
+ enabled.
+
2012-12-17 Juanma Barranquero <lekktu@gmail.com>
* makefile.w32-in ($(BLD)/editfns.$(O), $(BLD)/fileio.$(O))
errno = EINVAL;
else
{
- /* Copy the link target name, in wide characters, fro
+ /* Copy the link target name, in wide characters, from
reparse_data, then convert it to multibyte encoding in
the current locale's codepage. */
WCHAR *lwname;
acl_get_file (const char *fname, acl_type_t type)
{
PSECURITY_DESCRIPTOR psd = NULL;
+ const char *filename;
if (type == ACL_TYPE_ACCESS)
{
DACL_SECURITY_INFORMATION ;
int e = errno;
+ filename = map_w32_filename (fname, NULL);
+ if ((volume_info.flags & FILE_SUPPORTS_REPARSE_POINTS) != 0)
+ fname = chase_symlinks (filename);
+ else
+ fname = filename;
+
errno = 0;
if (!get_file_security (fname, si, psd, 0, &sd_len)
&& errno != ENOTSUP)
BOOL dflt;
BOOL dacl_present;
int e;
+ const char *filename;
if (acl_valid (acl) != 0
|| (type != ACL_TYPE_DEFAULT && type != ACL_TYPE_ACCESS))
return -1;
}
+ filename = map_w32_filename (fname, NULL);
+ if ((volume_info.flags & FILE_SUPPORTS_REPARSE_POINTS) != 0)
+ fname = chase_symlinks (filename);
+ else
+ fname = filename;
+
if (get_security_descriptor_owner ((PSECURITY_DESCRIPTOR)acl, &psid, &dflt)
&& psid)
flags |= OWNER_SECURITY_INFORMATION;
errno = 0;
set_file_security ((char *)fname, flags, (PSECURITY_DESCRIPTOR)acl);
err = GetLastError ();
- if (st >= 2)
- restore_privilege (&old2);
- if (st >= 1)
- restore_privilege (&old1);
+ if (st)
+ {
+ if (st >= 2)
+ restore_privilege (&old2);
+ restore_privilege (&old1);
+ revert_to_self ();
+ }
if (errno == ENOTSUP)
;