public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: xfs-oss <xfs@oss.sgi.com>
Subject: [PATCH 1/2] metadump: Fill attribute values with 'v' rather than NUL
Date: Mon, 06 Jul 2015 13:16:34 -0500	[thread overview]
Message-ID: <559AC602.5050309@sandeen.net> (raw)
In-Reply-To: <559AC5AA.5040900@sandeen.net>

Rather than memset attribute values to '\0', use the character 'v' -
otherwise in some cases we get attributes with a non-zero value
length which start with a NUL, and that makes some userspace tools
unhappy, yielding results like this:

security.oO^Lio.=0sAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/db/metadump.c b/db/metadump.c
index 2286b71..a30f90e 100644
--- a/db/metadump.c
+++ b/db/metadump.c
@@ -1083,8 +1083,8 @@ obfuscate_sf_attr(
 	xfs_dinode_t		*dip)
 {
 	/*
-	 * with extended attributes, obfuscate the names and zero the actual
-	 * values.
+	 * with extended attributes, obfuscate the names and fill the actual
+	 * values with 'v' (to see a valid string length, as opposed to NULLs)
 	 */
 
 	xfs_attr_shortform_t	*asfp;
@@ -1124,7 +1124,7 @@ obfuscate_sf_attr(
 		}
 
 		generate_obfuscated_name(0, asfep->namelen, &asfep->nameval[0]);
-		memset(&asfep->nameval[asfep->namelen], 0, asfep->valuelen);
+		memset(&asfep->nameval[asfep->namelen], 'v', asfep->valuelen);
 
 		asfep = (xfs_attr_sf_entry_t *)((char *)asfep +
 				XFS_ATTR_SF_ENTSIZE(asfep));
@@ -1302,7 +1302,7 @@ obfuscate_attr_block(
 				/* magic to handle attr and attr3 */
 				memset(block +
 					(bs - XFS_ATTR3_RMT_BUF_SPACE(mp, bs)),
-				      0, XFS_ATTR3_RMT_BUF_SPACE(mp, bs));
+				      'v', XFS_ATTR3_RMT_BUF_SPACE(mp, bs));
 		}
 		return;
 	}
@@ -1339,7 +1339,7 @@ obfuscate_attr_block(
 			}
 			generate_obfuscated_name(0, local->namelen,
 				&local->nameval[0]);
-			memset(&local->nameval[local->namelen], 0,
+			memset(&local->nameval[local->namelen], 'v',
 				be16_to_cpu(local->valuelen));
 		} else {
 			remote = xfs_attr3_leaf_name_remote(leaf, i);


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

  reply	other threads:[~2015-07-06 18:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-06 18:15 [PATCH 0/2] metadump: 2 more patches Eric Sandeen
2015-07-06 18:16 ` Eric Sandeen [this message]
2015-07-26 16:16   ` [PATCH 1/2] metadump: Fill attribute values with 'v' rather than NUL Christoph Hellwig
2015-07-06 18:17 ` [PATCH 2/2] metadump: handle multi-block directories 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=559AC602.5050309@sandeen.net \
    --to=sandeen@sandeen.net \
    --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