From 028f1af996bcfa542767dc379639ef2413a4140f Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 4 Feb 2019 03:34:33 -0600 Subject: [PATCH] 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 --- src/auth/AuthRegistry.cc | 10 ++-------- src/mon/MonClient.cc | 6 ++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/auth/AuthRegistry.cc b/src/auth/AuthRegistry.cc index 58807b62152..9d325604c0d 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 fd149192c8b..1ca1cedca3c 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(); -- 2.39.5