From c72a850fca2565c7110a902371df0ef89adb1537 Mon Sep 17 00:00:00 2001 From: Michal Ludvig Date: Wed, 28 Feb 2007 03:32:13 +0000 Subject: [PATCH] * S3/Config.py: Hide access key and secret key from debug output. git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@96 830e0280-6d2a-0410-9c65-932aecc39d9d --- ChangeLog | 2 ++ S3/Config.py | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 819a281a5..388fca2f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2007-02-28 Michal Ludvig + * S3/Config.py: Hide access key and secret key + from debug output. * S3/S3.py: Modify S3Error exception to work in python 2.4 (=> don't expect Exception is a new-style class). diff --git a/S3/Config.py b/S3/Config.py index 2bce05368..ec9b22c91 100644 --- a/S3/Config.py +++ b/S3/Config.py @@ -108,8 +108,12 @@ def parse_file(self, file, sections = []): data = is_data.groupdict() if r_quotes.match(data["value"]): data["value"] = data["value"][1:-1] - debug("ConfigParser: %s->%s" % (data["key"], data["value"])) self.__setitem__(data["key"], data["value"]) + if data["key"] in ("access_key", "secret_key"): + print_value = (data["value"][:3]+"...%d_chars..."+data["value"][-2:]) % (len(data["value"]) - 4) + else: + print_value = data["value"] + debug("ConfigParser: %s->%s" % (data["key"], print_value)) continue warning("Ignoring invalid line in '%s': %s" % (file, line))