Don't use random()/srandom()

We can create a initial verifier that is good enough by just using
the current time and the pid.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
libnfs-4.0.0-vitalif
Ronnie Sahlberg 2017-07-08 12:58:31 +10:00
parent 825d8c2aa3
commit 546c9455c7
1 changed files with 5 additions and 3 deletions

View File

@ -432,11 +432,10 @@ nfs_init_context(void)
{
struct nfs_context *nfs;
int i;
uint64_t v;
verifier4 verifier;
char client_name[MAX_CLIENT_NAME];
srandom(time(NULL));
nfs = malloc(sizeof(struct nfs_context));
if (nfs == NULL) {
return NULL;
@ -458,8 +457,11 @@ nfs_init_context(void)
nfs->version = NFS_V3;
/* NFSv4 parameters */
/* We need a "random" initial verifier */
v = rpc_current_time() << 32 | getpid();
for (i = 0; i < NFS4_VERIFIER_SIZE; i++) {
verifier[i] = random() & 0xff;
verifier[i] = v & 0xff;
v >>= 8;
}
nfs4_set_verifier(nfs, verifier);