emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111265: Follow symlinks in MS-Window


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111265: Follow symlinks in MS-Windows emulations of ACL functions.
Date: Tue, 18 Dec 2012 21:05:56 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111265
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Tue 2012-12-18 21:05:56 +0200
message:
  Follow symlinks in MS-Windows emulations of ACL functions.
  
   src/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.
modified:
  src/ChangeLog
  src/w32.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-12-17 20:59:04 +0000
+++ b/src/ChangeLog     2012-12-18 19:05:56 +0000
@@ -1,3 +1,11 @@
+2012-12-18  Eli Zaretskii  <address@hidden>
+
+       * 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  <address@hidden>
 
        * makefile.w32-in ($(BLD)/editfns.$(O), $(BLD)/fileio.$(O))

=== modified file 'src/w32.c'
--- a/src/w32.c 2012-12-17 19:14:34 +0000
+++ b/src/w32.c 2012-12-18 19:05:56 +0000
@@ -4518,7 +4518,7 @@
        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;
@@ -4766,6 +4766,7 @@
 acl_get_file (const char *fname, acl_type_t type)
 {
   PSECURITY_DESCRIPTOR psd = NULL;
+  const char *filename;
 
   if (type == ACL_TYPE_ACCESS)
     {
@@ -4776,6 +4777,12 @@
        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)
@@ -4819,6 +4826,7 @@
   BOOL dflt;
   BOOL dacl_present;
   int e;
+  const char *filename;
 
   if (acl_valid (acl) != 0
       || (type != ACL_TYPE_DEFAULT && type != ACL_TYPE_ACCESS))
@@ -4833,6 +4841,12 @@
       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;
@@ -4866,10 +4880,13 @@
   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)
     ;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]