Skip to content

Commit

Permalink
auth/cephx: make KeyServer::build_session_auth_info() less confusing
Browse files Browse the repository at this point in the history
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 <idryomov@gmail.com>
(cherry picked from commit 6f12cd3)
  • Loading branch information
idryomov committed Apr 16, 2021
1 parent d5328bc commit 4a484de
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/auth/cephx/CephxKeyServer.cc
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/auth/cephx/CephxKeyServer.h
Expand Up @@ -222,9 +222,9 @@ class KeyServer : public KeyStore {
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,
Expand Down
2 changes: 1 addition & 1 deletion src/mon/Monitor.cc
Expand Up @@ -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;
Expand Down

0 comments on commit 4a484de

Please sign in to comment.