]> git.proxmox.com Git - grub2.git/commitdiff
* Merge from Ubuntu:
authorColin Watson <cjwatson@canonical.com>
Sun, 18 Nov 2012 10:20:28 +0000 (10:20 +0000)
committerColin Watson <cjwatson@canonical.com>
Sun, 18 Nov 2012 10:20:28 +0000 (10:20 +0000)
  - Ignore symlink traversal failures in grub-mount readdir
    (LP: #1051306).

debian/changelog
debian/patches/mount_readdir_symlink_failures.patch [new file with mode: 0644]
debian/patches/series
util/grub-mount.c

index 3d12a80efad2fc032b3cc237c221b68a61071fd9..15b7ddbb96fbc9513c1f7c0f5e0163f17b946afe 100644 (file)
@@ -7,6 +7,9 @@ grub2 (2.00-8) UNRELEASED; urgency=low
     (>= 1.2.12-1) (cf. #625728).
   * Move powerpc-ibm-utils and powerpc-utils dependencies from
     grub-ieee1275-bin to grub-ieee1275 (closes: #693400).
+  * Merge from Ubuntu:
+    - Ignore symlink traversal failures in grub-mount readdir
+      (LP: #1051306).
 
  -- Colin Watson <cjwatson@debian.org>  Thu, 27 Sep 2012 13:25:46 +0100
 
diff --git a/debian/patches/mount_readdir_symlink_failures.patch b/debian/patches/mount_readdir_symlink_failures.patch
new file mode 100644 (file)
index 0000000..d213f6d
--- /dev/null
@@ -0,0 +1,31 @@
+Description: Ignore symlink traversal failures in grub-mount readdir
+Author: Colin Watson <cjwatson@ubuntu.com>
+Forwarded: https://lists.gnu.org/archive/html/grub-devel/2012-10/msg00021.html
+Last-Update: 2012-10-12
+
+Index: b/util/grub-mount.c
+===================================================================
+--- a/util/grub-mount.c
++++ b/util/grub-mount.c
+@@ -292,7 +292,20 @@
+       file = grub_file_open (tmp);
+       free (tmp);
+       if (! file)
+-        return translate_error ();
++        {
++          /* We cannot handle symlinks properly yet, and symlinks to
++             directories will cause us to reach here.  Symlink loops or
++             dangling symlinks will also cause an error.  For the
++             meantime, while treating these as zero-length files is wrong,
++             it's better than failing the whole readdir call by returning
++             translate_error ().
++
++             Ultimately, we should be able to tell from the
++             grub_dirhook_info that this is a symlink, and fill in the
++             attributes of the symlink rather than its target.  */
++          grub_errno = GRUB_ERR_NONE;
++          return 0;
++        }
+       st.st_size = file->size;
+       grub_file_close (file);
+       }
index 63a962df778c31b6d254e0b7c5d2c2f652fd3bf6..a6999b11fc2702cf611cb798638861401a9b020f 100644 (file)
@@ -27,3 +27,4 @@ mkconfig_stderr_handling.patch
 tftp_endianness.patch
 install_locale_langpack.patch
 mkconfig_nonexistent_loopback.patch
+mount_readdir_symlink_failures.patch
index e3eb1d7f3ee8e4b580d1a61a7964a27718e53906..b44e5d9946aea0858db83a41d43631eecbb1630a 100644 (file)
@@ -292,7 +292,20 @@ fuse_readdir (const char *path, void *buf,
        file = grub_file_open (tmp);
        free (tmp);
        if (! file)
-         return translate_error ();
+         {
+           /* We cannot handle symlinks properly yet, and symlinks to
+              directories will cause us to reach here.  Symlink loops or
+              dangling symlinks will also cause an error.  For the
+              meantime, while treating these as zero-length files is wrong,
+              it's better than failing the whole readdir call by returning
+              translate_error ().
+
+              Ultimately, we should be able to tell from the
+              grub_dirhook_info that this is a symlink, and fill in the
+              attributes of the symlink rather than its target.  */
+           grub_errno = GRUB_ERR_NONE;
+           return 0;
+         }
        st.st_size = file->size;
        grub_file_close (file);
       }