From 4975d6d3d171a2ef031b735204c24c44708fae3b Mon Sep 17 00:00:00 2001 From: liuchang0812 Date: Wed, 22 Feb 2017 17:49:22 +0800 Subject: [PATCH] common/auth: add override in headers Signed-off-by: liuchang0812 --- src/auth/Crypto.cc | 6 +++--- src/auth/KeyRing.h | 4 ++-- src/auth/RotatingKeyRing.h | 4 ++-- src/auth/cephx/CephxAuthorizeHandler.h | 4 ++-- src/auth/cephx/CephxClientHandler.h | 20 +++++++++---------- src/auth/cephx/CephxKeyServer.h | 4 ++-- src/auth/cephx/CephxProtocol.h | 2 +- src/auth/cephx/CephxServiceHandler.h | 6 +++--- src/auth/cephx/CephxSessionHandler.h | 12 +++++------ src/auth/none/AuthNoneAuthorizeHandler.h | 4 ++-- src/auth/none/AuthNoneClientHandler.h | 20 +++++++++---------- src/auth/none/AuthNoneProtocol.h | 2 +- src/auth/none/AuthNoneServiceHandler.h | 6 +++--- src/auth/none/AuthNoneSessionHandler.h | 12 +++++------ .../unknown/AuthUnknownAuthorizeHandler.h | 4 ++-- src/auth/unknown/AuthUnknownSessionHandler.h | 12 +++++------ 16 files changed, 61 insertions(+), 61 deletions(-) diff --git a/src/auth/Crypto.cc b/src/auth/Crypto.cc index 922db84793d..0186b7b2255 100644 --- a/src/auth/Crypto.cc +++ b/src/auth/Crypto.cc @@ -81,7 +81,7 @@ public: class CryptoNone : public CryptoHandler { public: CryptoNone() { } - ~CryptoNone() {} + ~CryptoNone() override {} int get_type() const override { return CEPH_CRYPTO_NONE; } @@ -103,7 +103,7 @@ public: class CryptoAES : public CryptoHandler { public: CryptoAES() { } - ~CryptoAES() {} + ~CryptoAES() override {} int get_type() const override { return CEPH_CRYPTO_AES; } @@ -267,7 +267,7 @@ public: slot(NULL), key(NULL), param(NULL) {} - ~CryptoAESKeyHandler() { + ~CryptoAESKeyHandler() override { SECITEM_FreeItem(param, PR_TRUE); if (key) PK11_FreeSymKey(key); diff --git a/src/auth/KeyRing.h b/src/auth/KeyRing.h index f876a6a14c4..002f67fffd8 100644 --- a/src/auth/KeyRing.h +++ b/src/auth/KeyRing.h @@ -45,7 +45,7 @@ public: a = k->second; return true; } - bool get_secret(const EntityName& name, CryptoKey& secret) const { + bool get_secret(const EntityName& name, CryptoKey& secret) const override { map::const_iterator k = keys.find(name); if (k == keys.end()) return false; @@ -53,7 +53,7 @@ public: return true; } bool get_service_secret(uint32_t service_id, uint64_t secret_id, - CryptoKey& secret) const { + CryptoKey& secret) const override { return false; } bool get_caps(const EntityName& name, diff --git a/src/auth/RotatingKeyRing.h b/src/auth/RotatingKeyRing.h index 762b55623c2..4a5e2375f0c 100644 --- a/src/auth/RotatingKeyRing.h +++ b/src/auth/RotatingKeyRing.h @@ -43,9 +43,9 @@ public: bool need_new_secrets(utime_t now) const; void set_secrets(RotatingSecrets& s); void dump_rotating() const; - bool get_secret(const EntityName& name, CryptoKey& secret) const; + bool get_secret(const EntityName& name, CryptoKey& secret) const override; bool get_service_secret(uint32_t service_id, uint64_t secret_id, - CryptoKey& secret) const; + CryptoKey& secret) const override; KeyRing *get_keyring(); }; diff --git a/src/auth/cephx/CephxAuthorizeHandler.h b/src/auth/cephx/CephxAuthorizeHandler.h index bf40d66e868..7246b80c71d 100644 --- a/src/auth/cephx/CephxAuthorizeHandler.h +++ b/src/auth/cephx/CephxAuthorizeHandler.h @@ -23,8 +23,8 @@ struct CephxAuthorizeHandler : public AuthAuthorizeHandler { bool verify_authorizer(CephContext *cct, KeyStore *keys, bufferlist& authorizer_data, bufferlist& authorizer_reply, EntityName& entity_name, uint64_t& global_id, - AuthCapsInfo& caps_info, CryptoKey& session_key, uint64_t *auid = NULL); - int authorizer_session_crypto(); + AuthCapsInfo& caps_info, CryptoKey& session_key, uint64_t *auid = NULL) override; + int authorizer_session_crypto() override; }; diff --git a/src/auth/cephx/CephxClientHandler.h b/src/auth/cephx/CephxClientHandler.h index 1256074ccf2..9c6522246e6 100644 --- a/src/auth/cephx/CephxClientHandler.h +++ b/src/auth/cephx/CephxClientHandler.h @@ -47,29 +47,29 @@ public: reset(); } - void reset() { + void reset() override { RWLock::WLocker l(lock); starting = true; server_challenge = 0; } - void prepare_build_request(); - int build_request(bufferlist& bl) const; - int handle_response(int ret, bufferlist::iterator& iter); - bool build_rotating_request(bufferlist& bl) const; + void prepare_build_request() override; + int build_request(bufferlist& bl) const override; + int handle_response(int ret, bufferlist::iterator& iter) override; + bool build_rotating_request(bufferlist& bl) const override; - int get_protocol() const { return CEPH_AUTH_CEPHX; } + int get_protocol() const override { return CEPH_AUTH_CEPHX; } - AuthAuthorizer *build_authorizer(uint32_t service_id) const; + AuthAuthorizer *build_authorizer(uint32_t service_id) const override; - bool need_tickets(); + bool need_tickets() override; - void set_global_id(uint64_t id) { + void set_global_id(uint64_t id) override { RWLock::WLocker l(lock); global_id = id; tickets.global_id = id; } private: - void validate_tickets(); + void validate_tickets() override; bool _need_tickets() const; }; diff --git a/src/auth/cephx/CephxKeyServer.h b/src/auth/cephx/CephxKeyServer.h index a7c267e4be7..ff91e96d582 100644 --- a/src/auth/cephx/CephxKeyServer.h +++ b/src/auth/cephx/CephxKeyServer.h @@ -200,7 +200,7 @@ public: KeyServer(CephContext *cct_, KeyRing *extra_secrets); bool generate_secret(CryptoKey& secret); - bool get_secret(const EntityName& name, CryptoKey& secret) const; + bool get_secret(const EntityName& name, CryptoKey& secret) const override; bool get_auth(const EntityName& name, EntityAuth& auth) const; bool get_caps(const EntityName& name, const string& type, AuthCapsInfo& caps) const; bool get_active_rotating_secret(const EntityName& name, CryptoKey& secret) const; @@ -217,7 +217,7 @@ public: bool get_service_secret(uint32_t service_id, CryptoKey& service_key, uint64_t& secret_id) const; bool get_service_secret(uint32_t service_id, uint64_t secret_id, - CryptoKey& secret) const; + CryptoKey& secret) const override; bool generate_secret(EntityName& name, CryptoKey& secret); diff --git a/src/auth/cephx/CephxProtocol.h b/src/auth/cephx/CephxProtocol.h index 997ddeb77b4..ebb25dc9be7 100644 --- a/src/auth/cephx/CephxProtocol.h +++ b/src/auth/cephx/CephxProtocol.h @@ -278,7 +278,7 @@ public: : AuthAuthorizer(CEPH_AUTH_CEPHX), cct(cct_), nonce(0) {} bool build_authorizer(); - bool verify_reply(bufferlist::iterator& reply); + bool verify_reply(bufferlist::iterator& reply) override; }; diff --git a/src/auth/cephx/CephxServiceHandler.h b/src/auth/cephx/CephxServiceHandler.h index 968d6e16f29..390a6dc1b87 100644 --- a/src/auth/cephx/CephxServiceHandler.h +++ b/src/auth/cephx/CephxServiceHandler.h @@ -27,10 +27,10 @@ class CephxServiceHandler : public AuthServiceHandler { public: CephxServiceHandler(CephContext *cct_, KeyServer *ks) : AuthServiceHandler(cct_), key_server(ks), server_challenge(0) {} - ~CephxServiceHandler() {} + ~CephxServiceHandler() override {} - int start_session(EntityName& name, bufferlist::iterator& indata, bufferlist& result_bl, AuthCapsInfo& caps); - int handle_request(bufferlist::iterator& indata, bufferlist& result_bl, uint64_t& global_id, AuthCapsInfo& caps, uint64_t *auid = NULL); + int start_session(EntityName& name, bufferlist::iterator& indata, bufferlist& result_bl, AuthCapsInfo& caps) override; + int handle_request(bufferlist::iterator& indata, bufferlist& result_bl, uint64_t& global_id, AuthCapsInfo& caps, uint64_t *auid = NULL) override; void build_cephx_response_header(int request_type, int status, bufferlist& bl); }; diff --git a/src/auth/cephx/CephxSessionHandler.h b/src/auth/cephx/CephxSessionHandler.h index 04184da45ba..6a19630bffe 100644 --- a/src/auth/cephx/CephxSessionHandler.h +++ b/src/auth/cephx/CephxSessionHandler.h @@ -26,24 +26,24 @@ public: CephxSessionHandler(CephContext *cct_, CryptoKey session_key, uint64_t features) : AuthSessionHandler(cct_, CEPH_AUTH_CEPHX, session_key), features(features) {} - ~CephxSessionHandler() {} + ~CephxSessionHandler() override {} - bool no_security() { + bool no_security() override { return false; } int _calc_signature(Message *m, uint64_t *psig); - int sign_message(Message *m); - int check_message_signature(Message *m) ; + int sign_message(Message *m) override; + int check_message_signature(Message *m) override ; // Cephx does not currently encrypt messages, so just return 0 if called. PLR - int encrypt_message(Message *m) { + int encrypt_message(Message *m) override { return 0; } - int decrypt_message(Message *m) { + int decrypt_message(Message *m) override { return 0; } diff --git a/src/auth/none/AuthNoneAuthorizeHandler.h b/src/auth/none/AuthNoneAuthorizeHandler.h index 256ad751e6b..b531cfb7736 100644 --- a/src/auth/none/AuthNoneAuthorizeHandler.h +++ b/src/auth/none/AuthNoneAuthorizeHandler.h @@ -23,8 +23,8 @@ struct AuthNoneAuthorizeHandler : public AuthAuthorizeHandler { bool verify_authorizer(CephContext *cct, KeyStore *keys, bufferlist& authorizer_data, bufferlist& authorizer_reply, EntityName& entity_name, uint64_t& global_id, - AuthCapsInfo& caps_info, CryptoKey& session_key, uint64_t *auid=NULL); - int authorizer_session_crypto(); + AuthCapsInfo& caps_info, CryptoKey& session_key, uint64_t *auid=NULL) override; + int authorizer_session_crypto() override; }; diff --git a/src/auth/none/AuthNoneClientHandler.h b/src/auth/none/AuthNoneClientHandler.h index d78cfbc22ab..369aa5480db 100644 --- a/src/auth/none/AuthNoneClientHandler.h +++ b/src/auth/none/AuthNoneClientHandler.h @@ -25,16 +25,16 @@ public: AuthNoneClientHandler(CephContext *cct_, RotatingKeyRing *rkeys) : AuthClientHandler(cct_) {} - void reset() { } + void reset() override { } - void prepare_build_request() {} - int build_request(bufferlist& bl) const { return 0; } - int handle_response(int ret, bufferlist::iterator& iter) { return 0; } - bool build_rotating_request(bufferlist& bl) const { return false; } + void prepare_build_request() override {} + int build_request(bufferlist& bl) const override { return 0; } + int handle_response(int ret, bufferlist::iterator& iter) override { return 0; } + bool build_rotating_request(bufferlist& bl) const override { return false; } - int get_protocol() const { return CEPH_AUTH_NONE; } + int get_protocol() const override { return CEPH_AUTH_NONE; } - AuthAuthorizer *build_authorizer(uint32_t service_id) const { + AuthAuthorizer *build_authorizer(uint32_t service_id) const override { RWLock::RLocker l(lock); AuthNoneAuthorizer *auth = new AuthNoneAuthorizer(); if (auth) { @@ -43,14 +43,14 @@ public: return auth; } - bool need_tickets() { return false; } + bool need_tickets() override { return false; } - void set_global_id(uint64_t id) { + void set_global_id(uint64_t id) override { RWLock::WLocker l(lock); global_id = id; } private: - void validate_tickets() {} + void validate_tickets() override {} }; #endif diff --git a/src/auth/none/AuthNoneProtocol.h b/src/auth/none/AuthNoneProtocol.h index 3e84e5388ec..8683c567416 100644 --- a/src/auth/none/AuthNoneProtocol.h +++ b/src/auth/none/AuthNoneProtocol.h @@ -26,7 +26,7 @@ struct AuthNoneAuthorizer : public AuthAuthorizer { ::encode(global_id, bl); return 0; } - bool verify_reply(bufferlist::iterator& reply) { return true; } + bool verify_reply(bufferlist::iterator& reply) override { return true; } }; #endif diff --git a/src/auth/none/AuthNoneServiceHandler.h b/src/auth/none/AuthNoneServiceHandler.h index 9fefd34dc21..120a7a9819e 100644 --- a/src/auth/none/AuthNoneServiceHandler.h +++ b/src/auth/none/AuthNoneServiceHandler.h @@ -24,14 +24,14 @@ class AuthNoneServiceHandler : public AuthServiceHandler { public: explicit AuthNoneServiceHandler(CephContext *cct_) : AuthServiceHandler(cct_) {} - ~AuthNoneServiceHandler() {} + ~AuthNoneServiceHandler() override {} - int start_session(EntityName& name, bufferlist::iterator& indata, bufferlist& result_bl, AuthCapsInfo& caps) { + int start_session(EntityName& name, bufferlist::iterator& indata, bufferlist& result_bl, AuthCapsInfo& caps) override { entity_name = name; caps.allow_all = true; return CEPH_AUTH_NONE; } - int handle_request(bufferlist::iterator& indata, bufferlist& result_bl, uint64_t& global_id, AuthCapsInfo& caps, uint64_t *auid = NULL) { + int handle_request(bufferlist::iterator& indata, bufferlist& result_bl, uint64_t& global_id, AuthCapsInfo& caps, uint64_t *auid = NULL) override { return 0; } void build_cephx_response_header(int request_type, int status, bufferlist& bl) { } diff --git a/src/auth/none/AuthNoneSessionHandler.h b/src/auth/none/AuthNoneSessionHandler.h index 36b7c744c31..a65b227fd51 100644 --- a/src/auth/none/AuthNoneSessionHandler.h +++ b/src/auth/none/AuthNoneSessionHandler.h @@ -21,28 +21,28 @@ class AuthNoneSessionHandler : public AuthSessionHandler { public: AuthNoneSessionHandler(CephContext *cct_, CryptoKey session_key) : AuthSessionHandler(cct_, CEPH_AUTH_NONE, session_key) {} - ~AuthNoneSessionHandler() {} + ~AuthNoneSessionHandler() override {} - bool no_security() { + bool no_security() override { return true; } // The None suite neither signs nor encrypts messages, so these functions just return success. // Since nothing was signed or encrypted, don't increment the stats. PLR - int sign_message(Message *m) { + int sign_message(Message *m) override { return 0; } - int check_message_signature(Message *m) { + int check_message_signature(Message *m) override { return 0; } - int encrypt_message(Message *m) { + int encrypt_message(Message *m) override { return 0; } - int decrypt_message(Message *m) { + int decrypt_message(Message *m) override { return 0; } diff --git a/src/auth/unknown/AuthUnknownAuthorizeHandler.h b/src/auth/unknown/AuthUnknownAuthorizeHandler.h index a9003e12753..9795ebfe9bf 100644 --- a/src/auth/unknown/AuthUnknownAuthorizeHandler.h +++ b/src/auth/unknown/AuthUnknownAuthorizeHandler.h @@ -23,8 +23,8 @@ struct AuthUnknownAuthorizeHandler : public AuthAuthorizeHandler { bool verify_authorizer(CephContext *cct, KeyStore *keys, bufferlist& authorizer_data, bufferlist& authorizer_reply, EntityName& entity_name, uint64_t& global_id, - AuthCapsInfo& caps_info, CryptoKey& session_key, uint64_t *auid=NULL); - int authorizer_session_crypto(); + AuthCapsInfo& caps_info, CryptoKey& session_key, uint64_t *auid=NULL) override; + int authorizer_session_crypto() override; }; diff --git a/src/auth/unknown/AuthUnknownSessionHandler.h b/src/auth/unknown/AuthUnknownSessionHandler.h index 80f27d362bd..d78a6d21aaa 100644 --- a/src/auth/unknown/AuthUnknownSessionHandler.h +++ b/src/auth/unknown/AuthUnknownSessionHandler.h @@ -23,28 +23,28 @@ class AuthUnknownSessionHandler : public AuthSessionHandler { public: AuthUnknownSessionHandler(CephContext *cct_, CryptoKey session_key) : AuthSessionHandler(cct_, CEPH_AUTH_UNKNOWN, session_key) {} - ~AuthUnknownSessionHandler() {} + ~AuthUnknownSessionHandler() override {} - bool no_security() { + bool no_security() override { return true; } // The Unknown suite neither signs nor encrypts messages, so these functions just return success. // Since nothing was signed or encrypted, don't increment the stats. PLR - int sign_message(Message *m) { + int sign_message(Message *m) override { return 0; } - int check_message_signature(Message *m) { + int check_message_signature(Message *m) override { return 0; } - int encrypt_message(Message *m) { + int encrypt_message(Message *m) override { return 0; } - int decrypt_message(Message *m) { + int decrypt_message(Message *m) override { return 0; }