From: Sage Weil Date: Sun, 28 Apr 2019 13:44:27 +0000 (-0500) Subject: mon/MonClient: do not crash on empty auth request buffer X-Git-Tag: v15.1.0~2797^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b99daab134553167260bfaf7e8e5c3da4d173102;p=ceph.git mon/MonClient: do not crash on empty auth request buffer Signed-off-by: Sage Weil --- diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index 3cf9b5899f4f..a024dc96b5a4 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) {