]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MonClient: behave if authorizer can't be built (yet)
authorSage Weil <sage@redhat.com>
Tue, 29 Jan 2019 16:48:15 +0000 (10:48 -0600)
committerSage Weil <sage@redhat.com>
Thu, 7 Feb 2019 18:10:33 +0000 (12:10 -0600)
Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/MonClient.cc

index 182e8fcdf85dfce8e60f7784aefbaf9721486903..8eab711c95b64c2ce2099c9a235ba7feb0f7fab5 100644 (file)
@@ -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,