]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
auth: remove AUTH_UNKNOWN weirdness, hardcoded defaults.
authorSage Weil <sage@redhat.com>
Mon, 4 Feb 2019 09:34:33 +0000 (03:34 -0600)
committerSage Weil <sage@redhat.com>
Thu, 7 Feb 2019 18:10:34 +0000 (12:10 -0600)
This is what the old code does so I kept it but I don't think it makes any sense.
Same with the defaults; let's just set the config option to something valid.

Signed-off-by: Sage Weil <sage@redhat.com>
src/auth/AuthRegistry.cc
src/mon/MonClient.cc

index 58807b62152154c18da9fbb792a8797180fa6b81..9d325604c0d718384131eeae826888a9e3b969b7 100644 (file)
@@ -55,14 +55,11 @@ void AuthRegistry::_parse_method_list(const string& s,
     } else if (i == "gss") {
       v->push_back(CEPH_AUTH_GSS);
     } else {
-      v->push_back(CEPH_AUTH_UNKNOWN);
       lderr(cct) << "WARNING: unknown auth protocol defined: " << i << dendl;
     }
   }
   if (v->empty()) {
-    lderr(cct) << "WARNING: no auth protocol defined, use 'cephx' by default"
-              << dendl;
-    v->push_back(CEPH_AUTH_CEPHX);
+    lderr(cct) << "WARNING: no auth protocol defined" << dendl;
   }
   ldout(cct,20) << __func__ << " " << s << " -> " << *v << dendl;
 }
@@ -82,14 +79,11 @@ void AuthRegistry::_parse_mode_list(const string& s,
     } else if (i == "secure") {
       v->push_back(CEPH_CON_MODE_SECURE);
     } else {
-      v->push_back(CEPH_CON_MODE_UNKNOWN);
       lderr(cct) << "WARNING: unknown connection mode " << i << dendl;
     }
   }
   if (v->empty()) {
-    lderr(cct) << "WARNING: no connection modes defined, use 'crc' by default"
-              << dendl;
-    v->push_back(CEPH_CON_MODE_CRC);
+    lderr(cct) << "WARNING: no connection modes defined" << dendl;
   }
   ldout(cct,20) << __func__ << " " << s << " -> " << *v << dendl;
 }
index fd149192c8be1acf7a1d9722c58eac678f6b54e3..1ca1cedca3c5c5c264a3a11e41867233bab91181 100644 (file)
@@ -1515,6 +1515,9 @@ int MonConnection::get_auth_request(
   if (auth_method < 0) {
     vector<uint32_t> as;
     auth_registry->get_supported_methods(con->get_peer_type(), &as);
+    if (as.empty()) {
+      return -EACCES;
+    }
     auth_method = as.front();
   }
   *method = auth_method;
@@ -1522,6 +1525,9 @@ int MonConnection::get_auth_request(
                                     preferred_modes);
   ldout(cct,10) << __func__ << " method " << *method
                << " preferred_modes " << *preferred_modes << dendl;
+  if (preferred_modes->empty()) {
+    return -EACCES;
+  }
 
   if (auth) {
     auth.reset();