From e5d6f6d33e4c6b0395f6bfbbc436fe72cfcdea12 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Mon, 23 May 2016 14:03:56 +0200 Subject: [PATCH] rgw: cosmetic changes in the new auth infra. Signed-off-by: Radoslaw Zarzynski --- src/rgw/librgw.cc | 4 ++-- src/rgw/rgw_acl_swift.cc | 3 ++- src/rgw/rgw_auth.cc | 6 +++--- src/rgw/rgw_auth.h | 24 ++++++++++++------------ src/rgw/rgw_rest_swift.cc | 2 +- src/rgw/rgw_swift_auth.cc | 6 +++--- 6 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/rgw/librgw.cc b/src/rgw/librgw.cc index ff60a1a8a8308..0aff2527b1de6 100644 --- a/src/rgw/librgw.cc +++ b/src/rgw/librgw.cc @@ -230,7 +230,7 @@ namespace rgw { /* FIXME: remove this after switching all handlers to the new authentication * infrastructure. */ - if (nullptr == s->auth_identity) { + if (! s->auth_identity) { s->auth_identity = rgw_auth_transform_old_authinfo(s); } @@ -342,7 +342,7 @@ namespace rgw { /* FIXME: remove this after switching all handlers to the new authentication * infrastructure. */ - if (nullptr == s->auth_identity) { + if (! s->auth_identity) { s->auth_identity = rgw_auth_transform_old_authinfo(s); } diff --git a/src/rgw/rgw_acl_swift.cc b/src/rgw/rgw_acl_swift.cc index 8bbb90d6bedc9..4cd51469409ef 100644 --- a/src/rgw/rgw_acl_swift.cc +++ b/src/rgw/rgw_acl_swift.cc @@ -63,7 +63,8 @@ static bool uid_is_public(const string& uid) sub.compare(".referrer") == 0; } -static bool extract_referer_urlspec(const string& uid, string& url_spec) +static bool extract_referer_urlspec(const std::string& uid, + std::string& url_spec) { const size_t pos = uid.find(':'); if (string::npos == pos) { diff --git a/src/rgw/rgw_auth.cc b/src/rgw/rgw_auth.cc index 5ab312c37d19c..b96795d665a48 100644 --- a/src/rgw/rgw_auth.cc +++ b/src/rgw/rgw_auth.cc @@ -306,11 +306,11 @@ typedef RGWKeystoneHTTPTransceiver RGWGetRevokedTokens; bool RGWKeystoneAuthEngine::is_applicable() const noexcept { - if (false == RGWTokenBasedAuthEngine::is_applicable()) { + if (! RGWTokenBasedAuthEngine::is_applicable()) { return false; } - return false == cct->_conf->rgw_keystone_url.empty(); + return ! cct->_conf->rgw_keystone_url.empty(); } KeystoneToken RGWKeystoneAuthEngine::decode_pki_token(const std::string& token) const @@ -390,7 +390,7 @@ RGWKeystoneAuthEngine::get_creds_info(const KeystoneToken& token, } } - return { + return RGWRemoteAuthApplier::AuthInfo { /* Suggested account name for the authenticated user. */ rgw_user(token.get_project_id()), /* User's display name (aka real name). */ diff --git a/src/rgw/rgw_auth.h b/src/rgw/rgw_auth.h index 09538fda4a83a..0bf39ec7faf3a 100644 --- a/src/rgw/rgw_auth.h +++ b/src/rgw/rgw_auth.h @@ -156,12 +156,12 @@ public: info(info) { } - virtual uint32_t get_perms_from_aclspec(const aclspec_t& aclspec) const override; - virtual bool is_admin_of(const rgw_user& uid) const override; - virtual bool is_owner_of(const rgw_user& uid) const override; - virtual uint32_t get_perm_mask() const { return info.perm_mask; } - virtual std::string to_str() const override; - virtual void load_acct_info(RGWUserInfo& user_info) const override; /* out */ + uint32_t get_perms_from_aclspec(const aclspec_t& aclspec) const override; + bool is_admin_of(const rgw_user& uid) const override; + bool is_owner_of(const rgw_user& uid) const override; + uint32_t get_perm_mask() const override { return info.perm_mask; } + std::string to_str() const override; + void load_acct_info(RGWUserInfo& user_info) const override; /* out */ struct Factory { virtual ~Factory() {} @@ -199,14 +199,14 @@ public: } - virtual uint32_t get_perms_from_aclspec(const aclspec_t& aclspec) const override; - virtual bool is_admin_of(const rgw_user& uid) const override; - virtual bool is_owner_of(const rgw_user& uid) const override; - virtual uint32_t get_perm_mask() const override { + uint32_t get_perms_from_aclspec(const aclspec_t& aclspec) const override; + bool is_admin_of(const rgw_user& uid) const override; + bool is_owner_of(const rgw_user& uid) const override; + uint32_t get_perm_mask() const override { return get_perm_mask(subuser, user_info); } - virtual std::string to_str() const override; - virtual void load_acct_info(RGWUserInfo& user_info) const override; /* out */ + std::string to_str() const override; + void load_acct_info(RGWUserInfo& user_info) const override; /* out */ struct Factory { virtual ~Factory() {} diff --git a/src/rgw/rgw_rest_swift.cc b/src/rgw/rgw_rest_swift.cc index 1a55de9759f51..3918603288a2a 100644 --- a/src/rgw/rgw_rest_swift.cc +++ b/src/rgw/rgw_rest_swift.cc @@ -1524,7 +1524,7 @@ int RGWHandler_REST_SWIFT::authorize() }; for (const auto engine : engines) { - if (!engine->is_applicable()) { + if (! engine->is_applicable()) { /* Engine said it isn't suitable for handling this particular * request. Let's try a next one. */ continue; diff --git a/src/rgw/rgw_swift_auth.cc b/src/rgw/rgw_swift_auth.cc index 7f41287a37360..ceb64aadf1c23 100644 --- a/src/rgw/rgw_swift_auth.cc +++ b/src/rgw/rgw_swift_auth.cc @@ -29,17 +29,17 @@ using namespace ceph::crypto; void RGWTempURLAuthApplier::modify_request_state(req_state * s) const /* in/out */ { bool inline_exists = false; - const string& filename = s->info.args.get("filename"); + const std::string& filename = s->info.args.get("filename"); s->info.args.get("inline", &inline_exists); if (inline_exists) { s->content_disp.override = "inline"; } else if (!filename.empty()) { - string fenc; + std::string fenc; url_encode(filename, fenc); s->content_disp.override = "attachment; filename=\"" + fenc + "\""; } else { - string fenc; + std::string fenc; url_encode(s->object.name, fenc); s->content_disp.fallback = "attachment; filename=\"" + fenc + "\""; } -- 2.39.5