From: Sage Weil Date: Mon, 14 Jan 2019 22:55:08 +0000 (-0600) Subject: mon/AuthMonitor: fix "finished with auth" condition check X-Git-Tag: v14.1.0~183^2~61 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=da326e7ab81bb126f829a6ebb4ac2708c3b3d8b7;p=ceph.git mon/AuthMonitor: fix "finished with auth" condition check We are sending the monmap prematurely (before we finish the authentication handshake). Signed-off-by: Sage Weil --- diff --git a/src/mon/AuthMonitor.cc b/src/mon/AuthMonitor.cc index 6e530a753344..3acc879e9a0c 100644 --- a/src/mon/AuthMonitor.cc +++ b/src/mon/AuthMonitor.cc @@ -640,9 +640,8 @@ bool AuthMonitor::prep_auth(MonOpRequestRef op, bool paxos_writable) try { if (start) { // new session - s->auth_handler->start_session(entity_name, &response_bl, - &s->con->peer_caps_info); - ret = 0; + ret = s->auth_handler->start_session(entity_name, &response_bl, + &s->con->peer_caps_info); } else { // request ret = s->auth_handler->handle_request( @@ -655,7 +654,8 @@ bool AuthMonitor::prep_auth(MonOpRequestRef op, bool paxos_writable) wait_for_active(op, new C_RetryMessage(this,op)); goto done; } - if (mon->ms_handle_authentication(s->con.get()) > 0) { + if (!s->authenticated && + mon->ms_handle_authentication(s->con.get()) > 0) { finished = true; } } catch (const buffer::error &err) { diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index b1f1f6a7dafd..1d481ee9b89f 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -5977,11 +5977,12 @@ int Monitor::ms_handle_authentication(Connection *con) << " " << *s << dendl; AuthCapsInfo &caps_info = con->get_peer_caps_info(); + int ret = 0; if (caps_info.allow_all) { s->caps.set_allow_all(); s->authenticated = true; + ret = 1; } - int ret = 1; if (caps_info.caps.length()) { bufferlist::const_iterator p = caps_info.caps.cbegin(); string str; @@ -5996,6 +5997,7 @@ int Monitor::ms_handle_authentication(Connection *con) if (ret >= 0) { if (s->caps.parse(str, NULL)) { s->authenticated = true; + ret = 1; } else { derr << __func__ << " unparseable caps '" << str << "' for " << con->get_peer_entity_name() << dendl;