From: Sage Weil Date: Mon, 4 Feb 2019 09:34:33 +0000 (-0600) Subject: auth: remove AUTH_UNKNOWN weirdness, hardcoded defaults. X-Git-Tag: v14.1.0~183^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=028f1af996bcfa542767dc379639ef2413a4140f;p=ceph.git auth: remove AUTH_UNKNOWN weirdness, hardcoded defaults. 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 --- diff --git a/src/auth/AuthRegistry.cc b/src/auth/AuthRegistry.cc index 58807b621521..9d325604c0d7 100644 --- a/src/auth/AuthRegistry.cc +++ b/src/auth/AuthRegistry.cc @@ -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; } diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index fd149192c8be..1ca1cedca3c5 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -1515,6 +1515,9 @@ int MonConnection::get_auth_request( if (auth_method < 0) { vector 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();