From 97cb011ea5e94d998275a68ccd05b709b00e1328 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 24 May 2018 20:40:48 -0500 Subject: [PATCH] auth/cephx/CephxProtocol: better random Signed-off-by: Sage Weil (cherry picked from commit 721d7e622bb4b301f0a69a6e236d25c49bd621ad) - get_random_bytes(), not cct->random() (cherry picked from commit b98db30e41bb623e2d03636aedabb6a5a59af596) --- src/auth/cephx/CephxProtocol.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/auth/cephx/CephxProtocol.cc b/src/auth/cephx/CephxProtocol.cc index 711a9a53da065..cd84f339f0920 100644 --- a/src/auth/cephx/CephxProtocol.cc +++ b/src/auth/cephx/CephxProtocol.cc @@ -296,7 +296,7 @@ CephXAuthorizer *CephXTicketHandler::build_authorizer(uint64_t global_id) const { CephXAuthorizer *a = new CephXAuthorizer(cct); a->session_key = session_key; - a->nonce = ((uint64_t)rand() << 32) + rand(); + get_random_bytes((char*)&a->nonce, sizeof(a->nonce)); __u8 authorizer_v = 1; ::encode(authorizer_v, a->bl); -- 2.39.5