From: Alex Elder <aelder@sgi.com>
To: xfs@oss.sgi.com
Subject: [PATCH 10/12] xfsprogs: use printable characters for obfuscated filenames
Date: Thu, 30 Dec 2010 14:42:30 -0600 [thread overview]
Message-ID: <1293741750.2294.372.camel@doink> (raw)
There is probably not much need for an extreme amount of randomness
in the obfuscated names produced in metadumps. Limit the character
set used for (most of) these filenames to printable characters
rather than every permitted byte. The result makes metadumps
a bit more natural to work with.
I chose the set of all upper- and lower-case letters, digits, and
the dash and underscore for the alphabet. It could easily be
expanded to include others.
Signed-off-by: Alex Elder <aelder@sgi.com>
---
db/metadump.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
Index: b/db/metadump.c
===================================================================
--- a/db/metadump.c
+++ b/db/metadump.c
@@ -377,12 +377,11 @@ clear_nametable(void)
static inline uchar_t
random_filename_char(void)
{
- uchar_t c;
+ static uchar_t filename_alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz"
+ "0123456789-_";
- do {
- c = random() % 127 + 1;
- } while (c == '/');
- return c;
+ return filename_alphabet[random() % (sizeof filename_alphabet - 1)];
}
/*
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
reply other threads:[~2010-12-30 20:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1293741750.2294.372.camel@doink \
--to=aelder@sgi.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