From 60d823363aa606e281a7696452381517c8f2d9cc Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Tue, 25 Mar 2025 21:55:22 -0400 Subject: [PATCH] auth/cephx: enforce sorted config keys Makes future additions avoid conflicts. Signed-off-by: Patrick Donnelly (cherry picked from commit 6ca5288570a8e6f4edb7b4f7ca0c47b9c4f0d212) --- src/auth/cephx/CephxServiceHandler.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/auth/cephx/CephxServiceHandler.cc b/src/auth/cephx/CephxServiceHandler.cc index 4b61df25bad..df886514352 100644 --- a/src/auth/cephx/CephxServiceHandler.cc +++ b/src/auth/cephx/CephxServiceHandler.cc @@ -45,9 +45,11 @@ CephxServiceHandler::CephxServiceHandler(CephContext *cct_, KeyServer *ks) std::vector CephxServiceHandler::get_tracked_keys() const noexcept { - return { - "cephx_allowed_ciphers"s - }; + static constexpr auto as_sv = std::to_array({ + "cephx_allowed_ciphers", + }); + static_assert(std::is_sorted(as_sv.begin(), as_sv.end()), "keys are not sorted!"); + return {as_sv.begin(), as_sv.end()}; } void CephxServiceHandler::init_conf(const ConfigProxy& conf) { -- 2.39.5