From: Kefu Chai Date: Fri, 8 Dec 2017 05:40:29 +0000 (+0800) Subject: Revert "rgw: Support certain archaic and antiquated distributions" X-Git-Tag: v13.0.2~575^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=483758351fbdaa4c74ed718d7bd244a5193717dc;p=ceph.git Revert "rgw: Support certain archaic and antiquated distributions" This reverts commit af8d9bdf07ab97b9d9387f68ba0fedccce803073. Signed-off-by: Kefu Chai --- diff --git a/src/rgw/rgw_iam_policy.cc b/src/rgw/rgw_iam_policy.cc index 97aaa3c7745..828399551cf 100644 --- a/src/rgw/rgw_iam_policy.cc +++ b/src/rgw/rgw_iam_policy.cc @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -26,7 +27,10 @@ using std::find; using std::int64_t; using std::move; using std::pair; +using std::regex; +using std::regex_match; using std::size_t; +using std::smatch; using std::string; using std::stringstream; using std::ostream; @@ -35,11 +39,11 @@ using std::uint64_t; using std::unordered_map; using boost::container::flat_set; -using boost::regex; -using boost::regex_constants::ECMAScript; -using boost::regex_constants::optimize; -using boost::regex_match; -using boost::smatch; +using std::regex; +using std::regex_constants::ECMAScript; +using std::regex_constants::optimize; +using std::regex_match; +using std::smatch; using rapidjson::BaseReaderHandler; using rapidjson::UTF8; @@ -205,15 +209,13 @@ ARN::ARN(const rgw_bucket& b, const string& o) } boost::optional ARN::parse(const string& s, bool wildcards) { - static const char str_wild[] = "arn:([^:]*):([^:]*):([^:]*):([^:]*):([^:]*)"; - static const regex rx_wild(str_wild, - sizeof(str_wild) - 1, - ECMAScript | optimize); - static const char str_no_wild[] - = "arn:([^:*]*):([^:*]*):([^:*]*):([^:*]*):([^:*]*)"; - static const regex rx_no_wild(str_no_wild, - sizeof(str_no_wild) - 1, - ECMAScript | optimize); + static const regex rx_wild("arn:([^:]*):([^:]*):([^:]*):([^:]*):([^:]*)", + std::regex_constants::ECMAScript | + std::regex_constants::optimize); + static const regex rx_no_wild( + "arn:([^:*]*):([^:*]*):([^:*]*):([^:*]*):([^:*]*)", + std::regex_constants::ECMAScript | + std::regex_constants::optimize); smatch match; @@ -738,7 +740,8 @@ static boost::optional parse_principal(CephContext* cct, TokenID t, static const char rx_str[] = "([^/]*)/(.*)"; static const regex rx(rx_str, sizeof(rx_str) - 1, - ECMAScript | optimize); + std::regex_constants::ECMAScript | + std::regex_constants::optimize); smatch match; if (regex_match(a->resource, match, rx) && match.size() == 3) { if (match[1] == "user") { diff --git a/src/rgw/rgw_role.cc b/src/rgw/rgw_role.cc index 2b89e4f231d..61dca85bd04 100644 --- a/src/rgw/rgw_role.cc +++ b/src/rgw/rgw_role.cc @@ -1,7 +1,6 @@ #include #include - -#include +#include #include "common/errno.h" #include "common/Formatter.h" @@ -377,14 +376,14 @@ bool RGWRole::validate_input() return false; } - boost::regex regex_name("[A-Za-z0-9:=,.@-]+"); - if (! boost::regex_match(name, regex_name)) { + std::regex regex_name("[A-Za-z0-9:=,.@-]+"); + if (! std::regex_match(name, regex_name)) { ldout(cct, 0) << "ERROR: Invalid chars in name " << dendl; return false; } - boost::regex regex_path("(/[!-~]+/)|(/)"); - if (! boost::regex_match(path,regex_path)) { + std::regex regex_path("(/[!-~]+/)|(/)"); + if (! std::regex_match(path,regex_path)) { ldout(cct, 0) << "ERROR: Invalid chars in path " << dendl; return false; }