From: Ilya Dryomov Date: Thu, 15 Apr 2021 13:18:58 +0000 (+0200) Subject: auth/cephx: make KeyServer::build_session_auth_info() less confusing X-Git-Tag: v14.2.20~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4a484defa41990fd66da31a0d82368eaa41ecbb5;p=ceph.git auth/cephx: make KeyServer::build_session_auth_info() less confusing The second KeyServer::build_session_auth_info() overload is used only by the monitor, for mon <-> mon authentication. The monitor passes in service_secret (mon secret) and secret_id (-1). The TTL is irrelevant because there is no rotation. However the signature doesn't make it obvious. Clarify that service_secret and secret_id are input parameters and info is the only output parameter. Signed-off-by: Ilya Dryomov (cherry picked from commit 6f12cd3688b753633c8ff29fb3bd64758f960b2b) --- diff --git a/src/auth/cephx/CephxKeyServer.cc b/src/auth/cephx/CephxKeyServer.cc index 700e4abf78b5..0fcf4536202e 100644 --- a/src/auth/cephx/CephxKeyServer.cc +++ b/src/auth/cephx/CephxKeyServer.cc @@ -449,9 +449,9 @@ int KeyServer::build_session_auth_info(uint32_t service_id, int KeyServer::build_session_auth_info(uint32_t service_id, const AuthTicket& parent_ticket, - CephXSessionAuthInfo& info, - CryptoKey& service_secret, - uint64_t secret_id) + const CryptoKey& service_secret, + uint64_t secret_id, + CephXSessionAuthInfo& info) { info.service_secret = service_secret; info.secret_id = secret_id; diff --git a/src/auth/cephx/CephxKeyServer.h b/src/auth/cephx/CephxKeyServer.h index 390e2e4f1707..2662c64c0f17 100644 --- a/src/auth/cephx/CephxKeyServer.h +++ b/src/auth/cephx/CephxKeyServer.h @@ -222,9 +222,9 @@ public: CephXSessionAuthInfo& info); int build_session_auth_info(uint32_t service_id, const AuthTicket& parent_ticket, - CephXSessionAuthInfo& info, - CryptoKey& service_secret, - uint64_t secret_id); + const CryptoKey& service_secret, + uint64_t secret_id, + CephXSessionAuthInfo& info); /* get current secret for specific service type */ bool get_service_secret(uint32_t service_id, CryptoKey& secret, diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index d7665a15d75b..edf3b78933dd 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -6203,7 +6203,7 @@ bool Monitor::ms_get_authorizer(int service_id, AuthAuthorizer **authorizer) } ret = key_server.build_session_auth_info( - service_id, auth_ticket_info.ticket, info, secret, (uint64_t)-1); + service_id, auth_ticket_info.ticket, secret, (uint64_t)-1, info); if (ret < 0) { dout(0) << __func__ << " failed to build mon session_auth_info " << cpp_strerror(ret) << dendl;