]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Support certain archaic and antiquated distributions 15498/head
authorAdam C. Emerson <aemerson@redhat.com>
Mon, 5 Jun 2017 19:46:45 +0000 (15:46 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Wed, 7 Jun 2017 16:11:40 +0000 (12:11 -0400)
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/rgw/rgw_iam_policy.cc
src/rgw/rgw_role.cc

index c12e243f1e00dbb962147509b2d88a53e69ac373..574236101b26e08710b5227adc4db6e17a06d92a 100644 (file)
@@ -3,11 +3,12 @@
 
 
 #include <cstring>
-#include <regex>
 #include <sstream>
 #include <stack>
 #include <utility>
 
+#include <boost/regex.hpp>
+
 #include "rapidjson/reader.h"
 
 #include "rgw_auth.h"
@@ -22,10 +23,7 @@ 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;
@@ -36,6 +34,11 @@ using std::unordered_map;
 using boost::container::flat_set;
 using boost::none;
 using boost::optional;
+using boost::regex;
+using boost::regex_constants::ECMAScript;
+using boost::regex_constants::optimize;
+using boost::regex_match;
+using boost::smatch;
 
 using rapidjson::BaseReaderHandler;
 using rapidjson::UTF8;
@@ -201,13 +204,15 @@ ARN::ARN(const rgw_bucket& b, const string& o)
 }
 
 optional<ARN> ARN::parse(const string& s, bool wildcards) {
-  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);
+  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);
 
   smatch match;
 
@@ -703,9 +708,9 @@ static optional<Principal> parse_principal(CephContext* cct, TokenID t,
       return Principal::tenant(std::move(a->account));
     }
 
-    static const regex rx("([^/]*)/(.*)",
-                         std::regex_constants::ECMAScript |
-                         std::regex_constants::optimize);
+    static const char rx_str[] = "([^/]*)/(.*)";
+    static const regex rx(rx_str, sizeof(rx_str) - 1,
+                         ECMAScript | optimize);
     smatch match;
     if (regex_match(a->resource, match, rx)) {
       ceph_assert(match.size() == 2);
index 236fe6e6aa448b49cf0ab692946407ffa279d17e..732b49c7431ed99c2a4a2aed0227593aca6cd010 100644 (file)
@@ -1,6 +1,7 @@
 #include <errno.h>
 #include <ctime>
-#include <regex>
+
+#include <boost/regex.hpp>
 
 #include "common/errno.h"
 #include "common/Formatter.h"
@@ -377,14 +378,14 @@ bool RGWRole::validate_input()
     return false;
   }
 
-  std::regex regex_name("[A-Za-z0-9:=,.@-]+");
-  if (! std::regex_match(name, regex_name)) {
+  boost::regex regex_name("[A-Za-z0-9:=,.@-]+");
+  if (! boost::regex_match(name, regex_name)) {
     ldout(cct, 0) << "ERROR: Invalid chars in name " << dendl;
     return false;
   }
 
-  std::regex regex_path("(/[!-~]+/)|(/)");
-  if (! std::regex_match(path,regex_path)) {
+  boost::regex regex_path("(/[!-~]+/)|(/)");
+  if (! boost::regex_match(path,regex_path)) {
     ldout(cct, 0) << "ERROR: Invalid chars in path " << dendl;
     return false;
   }