xfs
[Top] [All Lists]

[PATCH] xfs_metadump: obfuscate remote symlinks on CRC filesystems

To: xfs-oss <xfs@xxxxxxxxxxx>
Subject: [PATCH] xfs_metadump: obfuscate remote symlinks on CRC filesystems
From: Eric Sandeen <sandeen@xxxxxxxxxx>
Date: Fri, 19 Jun 2015 15:30:32 -0500
Delivered-to: xfs@xxxxxxxxxxx
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@xxxxxxxxxx>
---

diff --git a/db/metadump.c b/db/metadump.c
index a599571..80a41cd 100644
--- a/db/metadump.c
+++ b/db/metadump.c
@@ -1239,8 +1239,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

<Prev in Thread] Current Thread [Next in Thread>