From 290131b6761dfb90d4ad4c5a417d5443ca105031 Mon Sep 17 00:00:00 2001 From: Ricardo Dias Date: Wed, 9 Jan 2019 11:05:03 +0000 Subject: [PATCH] msg/async: msgr2: close connection when no authorizer is given Signed-off-by: Ricardo Dias --- src/msg/async/ProtocolV2.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/msg/async/ProtocolV2.cc b/src/msg/async/ProtocolV2.cc index daac5c5c359..5dadab9a7ed 100644 --- a/src/msg/async/ProtocolV2.cc +++ b/src/msg/async/ProtocolV2.cc @@ -2070,9 +2070,8 @@ CtPtr ProtocolV2::send_auth_request(std::vector &allowed_methods) { return nullptr; } - ldout(cct, 10) << __func__ - << " sending auth request len=" << authorizer->bl.length() - << dendl; + ldout(cct, 10) << __func__ << " sending auth request method=" << auth_method + << " len=" << authorizer->bl.length() << dendl; AuthRequestFrame authFrame(auth_method, authorizer->bl.length(), authorizer->bl); @@ -2116,9 +2115,16 @@ CtPtr ProtocolV2::handle_auth_bad_auth(char *payload, uint32_t length) { delete authorizer; authorizer = messenger->ms_deliver_get_authorizer(connection->peer_type, true); // try harder - ldout(cct, 10) << __func__ - << " sending auth request len=" << authorizer->bl.length() - << dendl; + + if (!authorizer) { + ldout(cct, 1) << __func__ + << " could not get an authorizer, closing connection" + << dendl; + return _fault(); + } + + ldout(cct, 10) << __func__ << " sending auth request method=" << auth_method + << " len=" << authorizer->bl.length() << dendl; AuthRequestFrame authFrame(auth_method, authorizer->bl.length(), authorizer->bl); -- 2.39.5