auth/cephx/CephxProtocol: better random
authorSage Weil <sage@redhat.com>
Fri, 25 May 2018 01:40:48 +0000 (20:40 -0500)
committerSage Weil <sage@redhat.com>
Fri, 25 May 2018 16:05:58 +0000 (11:05 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 721d7e622bb4b301f0a69a6e236d25c49bd621ad)

- get_random_bytes(), not cct->random()

(cherry picked from commit b98db30e41bb623e2d03636aedabb6a5a59af596)

src/auth/cephx/CephxProtocol.cc

index 711a9a53da0652969e66e7ecf3da6365294791fc..cd84f339f09207d251b864bf6cd6b317ee7bb25a 100644 (file)
@@ -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);