summaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-04-16 20:19:25 +0200
committerdefault <nobody@localhost>2023-04-16 20:19:25 +0200
commitf658f345cac7b24d6fa61f08b4ec09823d28b11a (patch)
treebf24a9a43ff15e907e131fc78516b3bf03d3a913 /utils.c
parent8205159f8ca98f525d892c02eb7dadfdf6d446d4 (diff)
Replaced random() with arc4random().
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/utils.c b/utils.c
index 24a6be6..24a2c66 100644
--- a/utils.c
+++ b/utils.c
@@ -198,10 +198,9 @@ 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;
+ rndbuf[0] = arc4random();
+ rndbuf[1] = arc4random();
+ rndbuf[2] = arc4random();
*clear_pwd = xs_base64_enc((char *)rndbuf, sizeof(rndbuf));
*hashed_pwd = hash_password(uid, *clear_pwd, NULL);