From b99daab134553167260bfaf7e8e5c3da4d173102 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sun, 28 Apr 2019 08:44:27 -0500 Subject: [PATCH] mon/MonClient: do not crash on empty auth request buffer Signed-off-by: Sage Weil --- src/mon/MonClient.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index 3cf9b5899f4..a024dc96b5a 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -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) { -- 2.47.3