summaryrefslogtreecommitdiffstats
path: root/src/rgw
diff options
context:
space:
mode:
authorCasey Bodley <cbodley@redhat.com>2021-11-05 21:02:17 +0100
committerCasey Bodley <cbodley@redhat.com>2021-11-05 21:17:28 +0100
commit578b43e8d5cc22a47bcb3efd0168544f03cb801c (patch)
tree4ea5b5a2ad702fdb8b04dd6cec7027af609c98f4 /src/rgw
parentMerge PR #43786 into master (diff)
downloadceph-578b43e8d5cc22a47bcb3efd0168544f03cb801c.tar.xz
ceph-578b43e8d5cc22a47bcb3efd0168544f03cb801c.zip
rgw/auth: perm_mask uses std::optional
resolves a compiler warning about an uninitialized variable in boost::optional: In file included from ../src/rgw/rgw_common.h:1508, from ../src/rgw/rgw_main.cc:18: ../src/rgw/rgw_auth.h: In member function ‘virtual rgw::auth::swift::DefaultStrategy::aplptr_t rgw::auth::swift::DefaultStrategy::_ZThn56_NK3rgw4auth5swift15D efaultStrategy15create_apl_turlEPN4ceph6common11CephContextEPK9req_stateRK11RGWUserInfo(ceph::common::CephContext*, const req_state*, const RGWUserInfo&) cons t’: ../src/rgw/rgw_auth.h:652:38: warning: ‘<unnamed>.boost::optional<unsigned int>::<unnamed>.boost::optional_detail::tc_optional_base<unsigned int>::m_storage’ may be used uninitialized [-Wmaybe-uninitialized] 652 | this->perm_mask = perm_mask.get(); | ~~~~~~~~~~~~~^~ In file included from ../src/rgw/rgw_rest_swift.h:14, from ../src/rgw/rgw_main.cc:24: ../src/rgw/rgw_swift_auth.h:27:73: note: ‘<anonymous>’ declared here 27 | : LocalApplier(cct, user_info, LocalApplier::NO_SUBUSER, boost::none) { | Signed-off-by: Casey Bodley <cbodley@redhat.com>
Diffstat (limited to 'src/rgw')
-rw-r--r--src/rgw/rgw_auth.cc2
-rw-r--r--src/rgw/rgw_auth.h13
-rw-r--r--src/rgw/rgw_auth_s3.h4
-rw-r--r--src/rgw/rgw_rest_s3.cc3
-rw-r--r--src/rgw/rgw_swift_auth.cc4
-rw-r--r--src/rgw/rgw_swift_auth.h8
6 files changed, 16 insertions, 18 deletions
diff --git a/src/rgw/rgw_auth.cc b/src/rgw/rgw_auth.cc
index 78d9ee5272b..dfb338818d7 100644
--- a/src/rgw/rgw_auth.cc
+++ b/src/rgw/rgw_auth.cc
@@ -911,7 +911,7 @@ rgw::auth::AnonymousEngine::authenticate(const DoutPrefixProvider* dpp, const re
auto apl = \
apl_factory->create_apl_local(cct, s, user_info,
rgw::auth::LocalApplier::NO_SUBUSER,
- boost::none);
+ std::nullopt);
return result_t::grant(std::move(apl));
}
}
diff --git a/src/rgw/rgw_auth.h b/src/rgw/rgw_auth.h
index c31e734a17b..db343649cc3 100644
--- a/src/rgw/rgw_auth.h
+++ b/src/rgw/rgw_auth.h
@@ -6,6 +6,7 @@
#define CEPH_RGW_AUTH_H
#include <functional>
+#include <optional>
#include <ostream>
#include <type_traits>
#include <system_error>
@@ -645,14 +646,10 @@ public:
LocalApplier(CephContext* const cct,
const RGWUserInfo& user_info,
std::string subuser,
- const boost::optional<uint32_t>& perm_mask)
+ const std::optional<uint32_t>& perm_mask)
: user_info(user_info),
- subuser(std::move(subuser)) {
- if (perm_mask) {
- this->perm_mask = perm_mask.get();
- } else {
- this->perm_mask = RGW_PERM_INVALID;
- }
+ subuser(std::move(subuser)),
+ perm_mask(perm_mask.value_or(RGW_PERM_INVALID)) {
}
@@ -679,7 +676,7 @@ public:
const req_state* s,
const RGWUserInfo& user_info,
const std::string& subuser,
- const boost::optional<uint32_t>& perm_mask) const = 0;
+ const std::optional<uint32_t>& perm_mask) const = 0;
};
};
diff --git a/src/rgw/rgw_auth_s3.h b/src/rgw/rgw_auth_s3.h
index ff28a27fb6d..edec31a3c6b 100644
--- a/src/rgw/rgw_auth_s3.h
+++ b/src/rgw/rgw_auth_s3.h
@@ -56,7 +56,7 @@ class STSAuthStrategy : public rgw::auth::Strategy,
const req_state* const s,
const RGWUserInfo& user_info,
const std::string& subuser,
- const boost::optional<uint32_t>& perm_mask) const override {
+ const std::optional<uint32_t>& perm_mask) const override {
auto apl = rgw::auth::add_sysreq(cct, store, s,
rgw::auth::LocalApplier(cct, user_info, subuser, perm_mask));
return aplptr_t(new decltype(apl)(std::move(apl)));
@@ -174,7 +174,7 @@ class AWSAuthStrategy : public rgw::auth::Strategy,
const req_state* const s,
const RGWUserInfo& user_info,
const std::string& subuser,
- const boost::optional<uint32_t>& perm_mask) const override {
+ const std::optional<uint32_t>& perm_mask) const override {
auto apl = rgw::auth::add_sysreq(cct, store, s,
rgw::auth::LocalApplier(cct, user_info, subuser, perm_mask));
/* TODO(rzarzynski): replace with static_ptr. */
diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc
index 73f3ed5729a..a02ca472ebc 100644
--- a/src/rgw/rgw_rest_s3.cc
+++ b/src/rgw/rgw_rest_s3.cc
@@ -5926,7 +5926,8 @@ rgw::auth::s3::LocalEngine::authenticate(
return result_t::deny(-ERR_SIGNATURE_NO_MATCH);
}
- auto apl = apl_factory->create_apl_local(cct, s, user->get_info(), k.subuser, boost::none);
+ auto apl = apl_factory->create_apl_local(cct, s, user->get_info(),
+ k.subuser, std::nullopt);
return result_t::grant(std::move(apl), completer_factory(k.key));
}
diff --git a/src/rgw/rgw_swift_auth.cc b/src/rgw/rgw_swift_auth.cc
index 3791e7d9214..c34ee221edf 100644
--- a/src/rgw/rgw_swift_auth.cc
+++ b/src/rgw/rgw_swift_auth.cc
@@ -461,7 +461,7 @@ ExternalTokenEngine::authenticate(const DoutPrefixProvider* dpp,
auto apl = apl_factory->create_apl_local(cct, s, user->get_info(),
extract_swift_subuser(swift_user),
- boost::none);
+ std::nullopt);
return result_t::grant(std::move(apl));
}
@@ -615,7 +615,7 @@ SignedTokenEngine::authenticate(const DoutPrefixProvider* dpp,
auto apl = apl_factory->create_apl_local(cct, s, user->get_info(),
extract_swift_subuser(swift_user),
- boost::none);
+ std::nullopt);
return result_t::grant(std::move(apl));
}
diff --git a/src/rgw/rgw_swift_auth.h b/src/rgw/rgw_swift_auth.h
index 13dc1b63a56..166a2ad793e 100644
--- a/src/rgw/rgw_swift_auth.h
+++ b/src/rgw/rgw_swift_auth.h
@@ -24,7 +24,7 @@ class TempURLApplier : public rgw::auth::LocalApplier {
public:
TempURLApplier(CephContext* const cct,
const RGWUserInfo& user_info)
- : LocalApplier(cct, user_info, LocalApplier::NO_SUBUSER, boost::none) {
+ : LocalApplier(cct, user_info, LocalApplier::NO_SUBUSER, std::nullopt) {
};
void modify_request_state(const DoutPrefixProvider* dpp, req_state * s) const override; /* in/out */
@@ -153,8 +153,8 @@ class SwiftAnonymousApplier : public rgw::auth::LocalApplier {
public:
SwiftAnonymousApplier(CephContext* const cct,
const RGWUserInfo& user_info)
- : LocalApplier(cct, user_info, LocalApplier::NO_SUBUSER, boost::none) {
- };
+ : LocalApplier(cct, user_info, LocalApplier::NO_SUBUSER, std::nullopt) {
+ }
bool is_admin_of(const rgw_user& uid) const {return false;}
bool is_owner_of(const rgw_user& uid) const {return uid.id.compare(RGW_USER_ANON_ID) == 0;}
};
@@ -225,7 +225,7 @@ class DefaultStrategy : public rgw::auth::Strategy,
const req_state* const s,
const RGWUserInfo& user_info,
const std::string& subuser,
- const boost::optional<uint32_t>& perm_mask) const override {
+ const std::optional<uint32_t>& perm_mask) const override {
auto apl = \
rgw::auth::add_3rdparty(store, rgw_user(s->account_name),
rgw::auth::add_sysreq(cct, store, s,