From: Sage Weil Date: Thu, 21 Feb 2019 19:45:28 +0000 (-0600) Subject: auth/AuthRegistry: clear output vectors X-Git-Tag: v14.1.0~7^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=afb82013a768c7fcb728d4f7b54e629e79f020ae;p=ceph.git auth/AuthRegistry: clear output vectors Signed-off-by: Sage Weil --- diff --git a/src/auth/AuthRegistry.cc b/src/auth/AuthRegistry.cc index f89868cbfa5b..f10271800dac 100644 --- a/src/auth/AuthRegistry.cc +++ b/src/auth/AuthRegistry.cc @@ -46,6 +46,7 @@ void AuthRegistry::_parse_method_list(const string& s, if (sup_list.empty()) { lderr(cct) << "WARNING: empty auth protocol list" << dendl; } + v->clear(); for (auto& i : sup_list) { ldout(cct, 5) << "adding auth protocol: " << i << dendl; if (i == "cephx") { @@ -72,6 +73,7 @@ void AuthRegistry::_parse_mode_list(const string& s, if (sup_list.empty()) { lderr(cct) << "WARNING: empty auth protocol list" << dendl; } + v->clear(); for (auto& i : sup_list) { ldout(cct, 5) << "adding con mode: " << i << dendl; if (i == "crc") { @@ -158,6 +160,12 @@ void AuthRegistry::get_supported_methods( std::vector *methods, std::vector *modes) { + if (methods) { + methods->clear(); + } + if (modes) { + modes->clear(); + } std::scoped_lock l(lock); switch (cct->get_module_type()) { case CEPH_ENTITY_TYPE_CLIENT: @@ -248,6 +256,7 @@ void AuthRegistry::get_supported_modes( get_supported_methods(peer_type, nullptr, &s); if (auth_method == CEPH_AUTH_NONE) { // filter out all but crc for AUTH_NONE + modes->clear(); for (auto mode : s) { if (mode == CEPH_CON_MODE_CRC) { modes->push_back(mode);