From: Adam Kupczyk Date: Thu, 9 Mar 2017 15:56:49 +0000 (+0100) Subject: Moved crypt_sanitize operator<< from namespace std to namespace rgw::crypt_sanitize. X-Git-Tag: v12.0.2~34^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a3a90cfe0e315992bf225c092a0c6a8df71a2d28;p=ceph.git Moved crypt_sanitize operator<< from namespace std to namespace rgw::crypt_sanitize. Signed-off-by: Adam Kupczyk --- diff --git a/src/rgw/rgw_crypt_sanitize.cc b/src/rgw/rgw_crypt_sanitize.cc index 402c563ba75b..114ac08430ea 100644 --- a/src/rgw/rgw_crypt_sanitize.cc +++ b/src/rgw/rgw_crypt_sanitize.cc @@ -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; } - - +} } diff --git a/src/rgw/rgw_crypt_sanitize.h b/src/rgw/rgw_crypt_sanitize.h index 095b9345cb92..a4cf51f32106 100644 --- a/src/rgw/rgw_crypt_sanitize.h +++ b/src/rgw/rgw_crypt_sanitize.h @@ -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_ */