From 101148a2493b5e8d2d58b839425ac4c6a9b403ac Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 22 Oct 2009 15:25:26 -0700 Subject: [PATCH] auth: kill dead code The synchronous authorize() and authenticate() code paths aren't used. --- src/auth/AuthClientHandler.cc | 66 +---------------------------------- src/auth/AuthClientHandler.h | 3 -- src/mon/MonClient.cc | 14 -------- src/mon/MonClient.h | 2 -- 4 files changed, 1 insertion(+), 84 deletions(-) diff --git a/src/auth/AuthClientHandler.cc b/src/auth/AuthClientHandler.cc index 5f301a3ecc0f1..b02b0a267f2b0 100644 --- a/src/auth/AuthClientHandler.cc +++ b/src/auth/AuthClientHandler.cc @@ -48,29 +48,6 @@ int AuthClientProtocolHandler::build_request() return ret; } -int AuthClientProtocolHandler::do_request(double timeout) -{ - got_response = false; - client->client->send_auth_message(msg); - - // schedule timeout? - assert(timeout_event == 0); - timeout_event = new C_OpTimeout(this, timeout); - client->timer.add_event_after(timeout, timeout_event); - - cond.Wait(lock); - - dout(0) << "got_response=" << got_response << " got_timeout=" << got_timeout << dendl; - - // finish. - if (timeout_event) { - client->timer.cancel_event(timeout_event); - timeout_event = NULL; - } - - return status; -} - int AuthClientProtocolHandler::do_async_request(double timeout) { got_response = false; @@ -420,37 +397,11 @@ int AuthClientHandler::handle_response(int trans_id, Message *response) return handler->handle_response(ret, iter); } -int AuthClientHandler::start_session(AuthClient *client, double timeout) -{ - Mutex::Locker l(lock); - this->client = client; - dout(10) << "start_session" << dendl; - - AuthClientAuthenticateHandler handler(this, want, have); - - int err; - - do { - err = handler.build_request(); - dout(0) << "handler.build_request returned " << err << dendl; - if (err < 0) - return err; - - err = handler.do_request(timeout); - dout(0) << "handler.do_request returned " << err << dendl; - if (err < 0 && err != -EAGAIN) - return err; - - } while (err == -EAGAIN); - - return err; -} - int AuthClientHandler::send_session_request(AuthClient *client, AuthClientProtocolHandler *handler, double timeout) { Mutex::Locker l(lock); this->client = client; - dout(10) << "start_session" << dendl; + dout(10) << "send_session_request" << dendl; int err = handler->build_request(); dout(0) << "handler.build_request returned " << err << dendl; @@ -463,21 +414,6 @@ int AuthClientHandler::send_session_request(AuthClient *client, AuthClientProtoc return err; } -int AuthClientHandler::authorize(uint32_t service_id, double timeout) -{ - Mutex::Locker l(lock); - AuthClientAuthorizeHandler handler(this, service_id); - - int ret = handler.build_request(); - if (ret < 0) - return ret; - - ret = handler.do_request(timeout); - - dout(0) << "authorize returned " << ret << dendl; - - return ret; -} void AuthClientHandler::tick() { diff --git a/src/auth/AuthClientHandler.h b/src/auth/AuthClientHandler.h index ca17a0ffd5af5..93fbd5ad9a891 100644 --- a/src/auth/AuthClientHandler.h +++ b/src/auth/AuthClientHandler.h @@ -72,7 +72,6 @@ public: int build_request(); int handle_response(int ret, bufferlist::iterator& iter); - int do_request(double timeout); void reset() { status = 0; @@ -199,9 +198,7 @@ public: int handle_response(int trans_id, Message *response); - int start_session(AuthClient *client, double timeout); int send_session_request(AuthClient *client, AuthClientProtocolHandler *handler, double timeout); - int authorize(uint32_t service_id, double timeout); void tick(); int build_authorizer(uint32_t service_id, AuthAuthorizer& authorizer); diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index 557ec5c1cf854..9a79fb4d91291 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -340,15 +340,6 @@ void MonClient::handle_auth(MAuthReply *m) } -int MonClient::authenticate(double timeout) -{ - Mutex::Locker lock(monc_lock); - - auth_timeout = timeout; - - return auth.start_session(this, timeout); -} - // --------- void MonClient::_send_mon_message(Message *m, bool force) @@ -515,11 +506,6 @@ int MonClient::wait_authenticate(double timeout) return ret; } -int MonClient::authorize(double timeout) -{ - return auth.authorize(CEPH_ENTITY_TYPE_MON, timeout); -} - int MonClient::_start_auth_rotating() { if (!auth_principal_needs_rotating_keys(entity_name)) diff --git a/src/mon/MonClient.h b/src/mon/MonClient.h index 646730489962c..8c25a1d64f660 100644 --- a/src/mon/MonClient.h +++ b/src/mon/MonClient.h @@ -114,8 +114,6 @@ public: int wait_auth_rotating(double timeout); int mount(double mount_timeout); - int authenticate(double timeout); - int authorize(double timeout); int wait_authenticate(double timeout); -- 2.39.5