]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/AuthMonitor: fix "finished with auth" condition check
authorSage Weil <sage@redhat.com>
Mon, 14 Jan 2019 22:55:08 +0000 (16:55 -0600)
committerSage Weil <sage@redhat.com>
Thu, 7 Feb 2019 12:53:03 +0000 (06:53 -0600)
We are sending the monmap prematurely (before we finish the authentication
handshake).

Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/AuthMonitor.cc
src/mon/Monitor.cc

index 6e530a75334472f3a65a6602caa8615c78cec4ef..3acc879e9a0c69bda57bf3b1a9864eae4120d369 100644 (file)
@@ -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) {
index b1f1f6a7dafd0293711d0c4120d8838889c94a14..1d481ee9b89f8047777e060456c0a4df1ae6f60f 100644 (file)
@@ -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;