kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danburk...@apache.org
Subject kudu git commit: KUDU-1812: redact HexDump output
Date Fri, 23 Dec 2016 02:24:14 GMT
Repository: kudu
Updated Branches:
  refs/heads/branch-1.2.x e7b45d375 -> 7e55911f3


KUDU-1812: redact HexDump output

After auditing calls to HexDump across the (non-test) Kudu codebase, it
was found that all calls would require manual redaction. Instead of
requiring callers to manually redact, it's easier to do it centrally.

Change-Id: I8388b19801382c491c9bcd9a485b1978ec0f007e
Reviewed-on: http://gerrit.cloudera.org:8080/5567
Tested-by: Kudu Jenkins
Reviewed-by: Alexey Serbin <aserbin@cloudera.com>
Reviewed-by: Adar Dembo <adar@cloudera.com>
(cherry picked from commit 47f09e30fde1726531544ba530651af39d9aa29e)
Reviewed-on: http://gerrit.cloudera.org:8080/5571
Reviewed-by: Dan Burkert <danburkert@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/7e55911f
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/7e55911f
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/7e55911f

Branch: refs/heads/branch-1.2.x
Commit: 7e55911f33eab2b699f89e3e2d6a96f2bb3286cf
Parents: e7b45d3
Author: Dan Burkert <danburkert@apache.org>
Authored: Wed Dec 21 23:26:42 2016 -0800
Committer: Dan Burkert <danburkert@apache.org>
Committed: Fri Dec 23 02:23:37 2016 +0000

----------------------------------------------------------------------
 src/kudu/util/hexdump.cc | 8 +++++++-
 src/kudu/util/hexdump.h  | 9 +++++----
 2 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/7e55911f/src/kudu/util/hexdump.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/hexdump.cc b/src/kudu/util/hexdump.cc
index 250c7c0..8f7c6cd 100644
--- a/src/kudu/util/hexdump.cc
+++ b/src/kudu/util/hexdump.cc
@@ -15,16 +15,22 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#include "kudu/util/hexdump.h"
+
 #include <algorithm>
 #include <string>
 
 #include "kudu/gutil/stringprintf.h"
-#include "kudu/util/hexdump.h"
+#include "kudu/util/logging.h"
 #include "kudu/util/slice.h"
 
 namespace kudu {
 
 std::string HexDump(const Slice &slice) {
+  if (KUDU_SHOULD_REDACT()) {
+    return kRedactionMessage;
+  }
+
   std::string output;
   output.reserve(slice.size() * 5);
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/7e55911f/src/kudu/util/hexdump.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/hexdump.h b/src/kudu/util/hexdump.h
index 55deed4..eacfad2 100644
--- a/src/kudu/util/hexdump.h
+++ b/src/kudu/util/hexdump.h
@@ -23,10 +23,11 @@ namespace kudu {
 
 class Slice;
 
-// Generate an 'xxd'-style hexdump of the given slice.
-// This should only be used for debugging, as the format is
-// subject to change and it has not been implemented for
-// speed.
+// Generate an 'xxd'-style hexdump of the given slice.  This should only be used
+// for debugging, as the format is subject to change and it has not been
+// implemented for speed.
+//
+// The returned string will be redacted if redaction is enabled.
 std::string HexDump(const Slice &slice);
 
 } // namespace kudu


Mime
View raw message