From 3ccef662766658cfc42cf91d288dd84fb90f3382 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Wed, 9 Apr 2014 14:11:49 -0700 Subject: [PATCH] auth: AuthClientHandler const cleanup get_protocol(), build_request(), build_rotating_request(), and build_authorizer() can all be declared const now. Signed-off-by: Josh Durgin --- src/auth/AuthClientHandler.h | 8 ++++---- src/auth/cephx/CephxClientHandler.cc | 6 +++--- src/auth/cephx/CephxClientHandler.h | 12 ++++++------ src/auth/none/AuthNoneClientHandler.h | 8 ++++---- src/auth/unknown/AuthUnknownClientHandler.h | 8 ++++---- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/auth/AuthClientHandler.h b/src/auth/AuthClientHandler.h index 6a22140f728..8d8289340f1 100644 --- a/src/auth/AuthClientHandler.h +++ b/src/auth/AuthClientHandler.h @@ -58,16 +58,16 @@ public: validate_tickets(); } - virtual int get_protocol() = 0; + virtual int get_protocol() const = 0; virtual void reset() = 0; virtual void prepare_build_request() = 0; - virtual int build_request(bufferlist& bl) = 0; + virtual int build_request(bufferlist& bl) const = 0; virtual int handle_response(int ret, bufferlist::iterator& iter) = 0; - virtual bool build_rotating_request(bufferlist& bl) = 0; + virtual bool build_rotating_request(bufferlist& bl) const = 0; + virtual AuthAuthorizer *build_authorizer(uint32_t service_id) const = 0; - virtual AuthAuthorizer *build_authorizer(uint32_t service_id) = 0; virtual void validate_tickets() = 0; virtual bool need_tickets() = 0; diff --git a/src/auth/cephx/CephxClientHandler.cc b/src/auth/cephx/CephxClientHandler.cc index 7df5658c7db..b6d3501ecd5 100644 --- a/src/auth/cephx/CephxClientHandler.cc +++ b/src/auth/cephx/CephxClientHandler.cc @@ -27,7 +27,7 @@ #define dout_prefix *_dout << "cephx client: " -int CephxClientHandler::build_request(bufferlist& bl) +int CephxClientHandler::build_request(bufferlist& bl) const { ldout(cct, 10) << "build_request" << dendl; @@ -172,7 +172,7 @@ int CephxClientHandler::handle_response(int ret, bufferlist::iterator& indata) -AuthAuthorizer *CephxClientHandler::build_authorizer(uint32_t service_id) +AuthAuthorizer *CephxClientHandler::build_authorizer(uint32_t service_id) const { RWLock::RLocker l(lock); ldout(cct, 10) << "build_authorizer for service " << ceph_entity_type_name(service_id) << dendl; @@ -180,7 +180,7 @@ AuthAuthorizer *CephxClientHandler::build_authorizer(uint32_t service_id) } -bool CephxClientHandler::build_rotating_request(bufferlist& bl) +bool CephxClientHandler::build_rotating_request(bufferlist& bl) const { ldout(cct, 10) << "build_rotating_request" << dendl; CephXRequestHeader header; diff --git a/src/auth/cephx/CephxClientHandler.h b/src/auth/cephx/CephxClientHandler.h index 024cfb990aa..e99e0930b51 100644 --- a/src/auth/cephx/CephxClientHandler.h +++ b/src/auth/cephx/CephxClientHandler.h @@ -22,10 +22,10 @@ class CephContext; class CephxClientHandler : public AuthClientHandler { bool starting; - + /* envelope protocol parameters */ uint64_t server_challenge; - + CephXTicketManager tickets; CephXTicketHandler* ticket_handler; @@ -51,13 +51,13 @@ public: server_challenge = 0; } void prepare_build_request(); - int build_request(bufferlist& bl); + int build_request(bufferlist& bl) const; int handle_response(int ret, bufferlist::iterator& iter); - bool build_rotating_request(bufferlist& bl); + bool build_rotating_request(bufferlist& bl) const; - int get_protocol() { return CEPH_AUTH_CEPHX; } + int get_protocol() const { return CEPH_AUTH_CEPHX; } - AuthAuthorizer *build_authorizer(uint32_t service_id); + AuthAuthorizer *build_authorizer(uint32_t service_id) const; void validate_tickets(); bool need_tickets(); diff --git a/src/auth/none/AuthNoneClientHandler.h b/src/auth/none/AuthNoneClientHandler.h index 509ada8d454..c2aae4a54a9 100644 --- a/src/auth/none/AuthNoneClientHandler.h +++ b/src/auth/none/AuthNoneClientHandler.h @@ -28,13 +28,13 @@ public: void reset() { } void prepare_build_request() {} - int build_request(bufferlist& bl) { return 0; } + int build_request(bufferlist& bl) const { return 0; } int handle_response(int ret, bufferlist::iterator& iter) { return 0; } - bool build_rotating_request(bufferlist& bl) { return false; } + bool build_rotating_request(bufferlist& bl) const { return false; } - int get_protocol() { return CEPH_AUTH_NONE; } + int get_protocol() const { return CEPH_AUTH_NONE; } - AuthAuthorizer *build_authorizer(uint32_t service_id) { + AuthAuthorizer *build_authorizer(uint32_t service_id) const { RWLock::RLocker l(lock); AuthNoneAuthorizer *auth = new AuthNoneAuthorizer(); if (auth) { diff --git a/src/auth/unknown/AuthUnknownClientHandler.h b/src/auth/unknown/AuthUnknownClientHandler.h index 71ff0f4faed..f87a26b9613 100644 --- a/src/auth/unknown/AuthUnknownClientHandler.h +++ b/src/auth/unknown/AuthUnknownClientHandler.h @@ -28,13 +28,13 @@ public: void reset() { } void prepare_build_request() {} - int build_request(bufferlist& bl) { return 0; } + int build_request(bufferlist& bl) const { return 0; } int handle_response(int ret, bufferlist::iterator& iter) { return 0; } - bool build_rotating_request(bufferlist& bl) { return false; } + bool build_rotating_request(bufferlist& bl) const { return false; } - int get_protocol() { return CEPH_AUTH_UNKNOWN; } + int get_protocol() const { return CEPH_AUTH_UNKNOWN; } - AuthAuthorizer *build_authorizer(uint32_t service_id) { + AuthAuthorizer *build_authorizer(uint32_t service_id) const { RWLock::RLocker l(lock); AuthUnknownAuthorizer *auth = new AuthUnknownAuthorizer(); if (auth) {