public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: xfs-oss <xfs@oss.sgi.com>
Subject: [PATCH] xfs_metadump: obfuscate remote symlinks on CRC filesystems
Date: Fri, 19 Jun 2015 15:30:32 -0500	[thread overview]
Message-ID: <55847BE8.8010908@redhat.com> (raw)

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>
---

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

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

             reply	other threads:[~2015-06-19 20:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-19 20:30 Eric Sandeen [this message]
2015-06-21  9:14 ` [PATCH] xfs_metadump: obfuscate remote symlinks on CRC filesystems Christoph Hellwig
2015-06-22  1:54   ` Eric Sandeen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55847BE8.8010908@redhat.com \
    --to=sandeen@redhat.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox