From fafdbbf815ea44ca1813a4ab58547d487f6a3bfb Mon Sep 17 00:00:00 2001 From: default Date: Mon, 5 Jun 2023 18:29:25 +0200 Subject: Replaced usage of random() with xs_rnd_buf(). --- utils.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'utils.c') diff --git a/utils.c b/utils.c index 1c03fee..f5b02ae 100644 --- a/utils.c +++ b/utils.c @@ -6,6 +6,7 @@ #include "xs_json.h" #include "xs_time.h" #include "xs_openssl.h" +#include "xs_random.h" #include "snac.h" @@ -204,10 +205,7 @@ void new_password(const char *uid, d_char **clear_pwd, d_char **hashed_pwd) { int rndbuf[3]; - srandom(time(NULL) ^ getpid()); - rndbuf[0] = random() & 0xffffffff; - rndbuf[1] = random() & 0xffffffff; - rndbuf[2] = random() & 0xffffffff; + xs_rnd_buf(rndbuf, sizeof(rndbuf)); *clear_pwd = xs_base64_enc((char *)rndbuf, sizeof(rndbuf)); *hashed_pwd = hash_password(uid, *clear_pwd, NULL); -- cgit v1.2.3