summaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-06-05 18:29:25 +0200
committerdefault <nobody@localhost>2023-06-05 18:29:25 +0200
commitfafdbbf815ea44ca1813a4ab58547d487f6a3bfb (patch)
tree139aeaf983b3b634f4b3bdfa57bb63876bb2cf68 /utils.c
parente788a5bf8fde50cc8ba30390f829bb78e18add4d (diff)
Replaced usage of random() with xs_rnd_buf().
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c6
1 files changed, 2 insertions, 4 deletions
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);