]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_metadump: obfuscate remote symlinks on CRC filesystems progs-misc-fixes-1
authorEric Sandeen <sandeen@redhat.com>
Tue, 23 Jun 2015 01:38:18 +0000 (11:38 +1000)
committerDave Chinner <david@fromorbit.com>
Tue, 23 Jun 2015 01:38:18 +0000 (11:38 +1000)
On CRC filesystems, the symlink block starts with a header,
which contains magic, "XLSM"

The code happens to "work" today w/o corrupting anything,
because it seems "XSLM" as a string, decides it's too short
to obfuscate, and leaves it alone.

But the real symlink target is untouched.  Fix that by moving
the pointer to the string we want to obfuscate by the size
of the header, and shorten the length to obfuscate accordingly.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
db/metadump.c

index bdc48a0a6770202b85b681f88238c9777d9c7563..f9f43006c44f9fb9b7ab5d8c832dc1380620b1ee 100644 (file)
@@ -1240,8 +1240,12 @@ static void
 obfuscate_symlink_block(
        char                    *block)
 {
-       /* XXX: need to handle CRC headers */
-       obfuscate_path_components(block, mp->m_sb.sb_blocksize);
+       if (xfs_sb_version_hascrc(&(mp)->m_sb))
+               block += sizeof(struct xfs_dsymlink_hdr);
+
+       obfuscate_path_components(block,
+                                 XFS_SYMLINK_BUF_SPACE(mp,
+                                       mp->m_sb.sb_blocksize));
 }
 
 #define MAX_REMOTE_VALS                4095