diff options
author | default <nobody@localhost> | 2023-06-05 18:29:25 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2023-06-05 18:29:25 +0200 |
commit | fafdbbf815ea44ca1813a4ab58547d487f6a3bfb (patch) | |
tree | 139aeaf983b3b634f4b3bdfa57bb63876bb2cf68 /utils.c | |
parent | e788a5bf8fde50cc8ba30390f829bb78e18add4d (diff) |
Replaced usage of random() with xs_rnd_buf().
Diffstat (limited to 'utils.c')
-rw-r--r-- | utils.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -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); |