]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MonClient: do not crash on empty auth request buffer
authorSage Weil <sage@redhat.com>
Sun, 28 Apr 2019 13:44:27 +0000 (08:44 -0500)
committerSage Weil <sage@redhat.com>
Sun, 28 Apr 2019 13:45:03 +0000 (08:45 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/MonClient.cc

index 3cf9b5899f4faf3c05e46acbacd6d143d85094da..a024dc96b5a483903dfbf513f50fce61d0458e8e 100644 (file)
@@ -1430,14 +1430,15 @@ int MonClient::handle_auth_request(
   const ceph::buffer::list& payload,
   ceph::buffer::list *reply)
 {
-  // for some channels prior to nautilus (osd heartbeat), we tolerate the lack of
-  // an authorizer.
-  if (payload.length() == 0 &&
-      !con->get_messenger()->require_authorizer) {
-    handle_authentication_dispatcher->ms_handle_authentication(con);
-    return 1;
+  if (payload.length() == 0) {
+    // for some channels prior to nautilus (osd heartbeat), we
+    // tolerate the lack of an authorizer.
+    if (!con->get_messenger()->require_authorizer) {
+      handle_authentication_dispatcher->ms_handle_authentication(con);
+      return 1;
+    }
+    return -EACCES;
   }
-
   auth_meta->auth_mode = payload[0];
   if (auth_meta->auth_mode < AUTH_MODE_AUTHORIZER ||
       auth_meta->auth_mode > AUTH_MODE_AUTHORIZER_MAX) {