From 6596ecd1099cd8e81f2fd60a62d005ac659b97cb Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 4 Mar 2019 13:09:40 +0800 Subject: [PATCH] crimson/mon: implement Dispatcher::ms_get_authorizer() we need this method for supporting cephx authentication Signed-off-by: Kefu Chai --- src/crimson/mon/MonClient.cc | 21 ++++++++++++++++++++- src/crimson/mon/MonClient.h | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/crimson/mon/MonClient.cc b/src/crimson/mon/MonClient.cc index 4b61270c271f..dba89c9f5124 100644 --- a/src/crimson/mon/MonClient.cc +++ b/src/crimson/mon/MonClient.cc @@ -58,7 +58,7 @@ public: uint32_t want_keys); seastar::future<> close(); bool is_my_peer(const entity_addr_t& addr) const; - + AuthAuthorizer* get_authorizer(peer_type_t peer) const; seastar::future<> renew_tickets(); ceph::net::ConnectionRef get_conn(); @@ -105,6 +105,15 @@ seastar::future<> Connection::renew_tickets() return seastar::now(); } +AuthAuthorizer* Connection::get_authorizer(peer_type_t peer) const +{ + if (auth) { + return auth->build_authorizer(peer); + } else { + return nullptr; + } +} + std::unique_ptr Connection::create_auth(Ref m, const EntityName& name, @@ -354,6 +363,16 @@ seastar::future<> Client::ms_handle_reset(ceph::net::ConnectionRef conn) } } +AuthAuthorizer* Client::ms_get_authorizer(peer_type_t peer) const +{ + if (active_con) { + return active_con->get_authorizer(peer); + } else { + return nullptr; + } +} + + seastar::future<> Client::handle_monmap(ceph::net::ConnectionRef conn, Ref m) { diff --git a/src/crimson/mon/MonClient.h b/src/crimson/mon/MonClient.h index ef9bcb690561..ffce5b06d19c 100644 --- a/src/crimson/mon/MonClient.h +++ b/src/crimson/mon/MonClient.h @@ -90,6 +90,7 @@ private: seastar::future<> ms_dispatch(ceph::net::ConnectionRef conn, MessageRef m) override; seastar::future<> ms_handle_reset(ceph::net::ConnectionRef conn) override; + AuthAuthorizer* ms_get_authorizer(peer_type_t peer) const override; seastar::future<> handle_monmap(ceph::net::ConnectionRef conn, Ref m); -- 2.47.3