From a948c0d0de3b857d186e483be6bd931634bdff00 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 29 Jan 2019 10:48:15 -0600 Subject: [PATCH] mon/MonClient: behave if authorizer can't be built (yet) Signed-off-by: Sage Weil --- src/mon/MonClient.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index 182e8fcdf85..8eab711c95b 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -1237,9 +1237,14 @@ int MonClient::get_auth_request( auto auth_meta = con->get_auth_meta(); if (!auth) { lderr(cct) << __func__ << " but no auth handler is set up" << dendl; - return -1; + return -EACCES; } auth_meta->authorizer.reset(auth->build_authorizer(con->get_peer_type())); + if (!auth_meta->authorizer) { + lderr(cct) << __func__ << " failed to build_authorizer for type " + << ceph_entity_type_name(con->get_peer_type()) << dendl; + return -EACCES; + } auth_meta->auth_method = auth_meta->authorizer->protocol; auth_registry.get_supported_modes(con->get_peer_type(), auth_meta->auth_method,