]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
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 01:42:38 +0000 (20:42 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 721d7e622bb4b301f0a69a6e236d25c49bd621ad)

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

src/auth/cephx/CephxProtocol.cc

index 98a0511eeb0cb7cb8c159cf1e478d0402c965768..cc5f44964c2adeed0b7f357ae2fd9af5f573ab16 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);