]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Moved crypt_sanitize operator<< from namespace std to namespace rgw::crypt_sanitize.
authorAdam Kupczyk <akupczyk@mirantis.com>
Thu, 9 Mar 2017 15:56:49 +0000 (16:56 +0100)
committerAdam Kupczyk <akupczyk@mirantis.com>
Wed, 5 Apr 2017 16:31:58 +0000 (18:31 +0200)
Signed-off-by: Adam Kupczyk <akupczyk@mirantis.com>
src/rgw/rgw_crypt_sanitize.cc
src/rgw/rgw_crypt_sanitize.h

index 402c563ba75b8533f1fecb26ed305570dc3d51b6..114ac08430ea4efb9f1ac038a528d2fe6166948f 100644 (file)
@@ -15,10 +15,7 @@ const char* HTTP_X_AMZ_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY = "HTTP_X_AMZ_SERVER_
 const char* x_amz_server_side_encryption_customer_key = "x-amz-server-side-encryption-customer-key";
 const char* dollar_x_amz_server_side_encryption_customer_key = "$x-amz-server-side-encryption-customer-key";
 const char* suppression_message = "=suppressed due to key presence=";
-}
-}
 
-namespace std {
 std::ostream& operator<<(std::ostream& out, const rgw::crypt_sanitize::env& e) {
   if (g_ceph_context->_conf->rgw_crypt_suppress_logs) {
     if (boost::algorithm::iequals(
@@ -76,7 +73,7 @@ std::ostream& operator<<(std::ostream& out, const rgw::crypt_sanitize::auth& x)
 
 std::ostream& operator<<(std::ostream& out, const rgw::crypt_sanitize::log_content& x) {
   if (g_ceph_context->_conf->rgw_crypt_suppress_logs &&
-       strstr(x.buf, rgw::crypt_sanitize::x_amz_server_side_encryption_customer_key) != nullptr) {
+      boost::algorithm::ifind_first(x.buf, rgw::crypt_sanitize::x_amz_server_side_encryption_customer_key)) {
     out << rgw::crypt_sanitize::suppression_message;
     return out;
   }
@@ -84,6 +81,5 @@ std::ostream& operator<<(std::ostream& out, const rgw::crypt_sanitize::log_conte
   return out;
 }
 
-
-
+}
 }
index 095b9345cb920e4715a708f2eaba706a3105ff3d..a4cf51f32106b59e698324dffdd8bf23866af35b 100644 (file)
@@ -9,7 +9,9 @@
 namespace rgw {
 namespace crypt_sanitize {
 
-
+/*
+ * Temporary container for suppressing printing if variable contains secret key.
+ */
 struct env {
   boost::string_ref name;
   boost::string_ref value;
@@ -18,6 +20,9 @@ struct env {
   : name(name), value(value) {}
 };
 
+/*
+ * Temporary container for suppressing printing if aws meta attributes contains secret key.
+ */
 struct x_meta_map {
   boost::string_ref name;
   boost::string_ref value;
@@ -25,6 +30,9 @@ struct x_meta_map {
   : name(name), value(value) {}
 };
 
+/*
+ * Temporary container for suppressing printing if s3_policy calculation variable contains secret key.
+ */
 struct s3_policy {
   boost::string_ref name;
   boost::string_ref value;
@@ -32,6 +40,9 @@ struct s3_policy {
   : name(name), value(value) {}
 };
 
+/*
+ * Temporary container for suppressing printing if auth string contains secret key.
+ */
 struct auth {
   const req_state* const s;
   boost::string_ref value;
@@ -39,20 +50,20 @@ struct auth {
   : s(s), value(value) {}
 };
 
+/*
+ * Temporary container for suppressing printing if log made from civetweb may contain secret key.
+ */
 struct log_content {
   const char* buf;
   log_content(const char* buf)
   : buf(buf) {}
 };
 
-}
-}
-
-namespace std {
 std::ostream& operator<<(std::ostream& out, const rgw::crypt_sanitize::env& e);
 std::ostream& operator<<(std::ostream& out, const rgw::crypt_sanitize::x_meta_map& x);
 std::ostream& operator<<(std::ostream& out, const rgw::crypt_sanitize::s3_policy& x);
 std::ostream& operator<<(std::ostream& out, const rgw::crypt_sanitize::auth& x);
 std::ostream& operator<<(std::ostream& out, const rgw::crypt_sanitize::log_content& x);
 }
+}
 #endif /* RGW_RGW_CRYPT_SANITIZE_H_ */