diff options
| author | 2023-06-05 18:29:25 +0200 | |
|---|---|---|
| committer | 2023-06-05 18:29:25 +0200 | |
| commit | fafdbbf815ea44ca1813a4ab58547d487f6a3bfb (patch) | |
| tree | 139aeaf983b3b634f4b3bdfa57bb63876bb2cf68 /utils.c | |
| parent | Some prototype tweaks. (diff) | |
| download | penes-snac2-fafdbbf815ea44ca1813a4ab58547d487f6a3bfb.tar.gz penes-snac2-fafdbbf815ea44ca1813a4ab58547d487f6a3bfb.tar.xz penes-snac2-fafdbbf815ea44ca1813a4ab58547d487f6a3bfb.zip | |
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 @@ | |||
| 6 | #include "xs_json.h" | 6 | #include "xs_json.h" |
| 7 | #include "xs_time.h" | 7 | #include "xs_time.h" |
| 8 | #include "xs_openssl.h" | 8 | #include "xs_openssl.h" |
| 9 | #include "xs_random.h" | ||
| 9 | 10 | ||
| 10 | #include "snac.h" | 11 | #include "snac.h" |
| 11 | 12 | ||
| @@ -204,10 +205,7 @@ void new_password(const char *uid, d_char **clear_pwd, d_char **hashed_pwd) | |||
| 204 | { | 205 | { |
| 205 | int rndbuf[3]; | 206 | int rndbuf[3]; |
| 206 | 207 | ||
| 207 | srandom(time(NULL) ^ getpid()); | 208 | xs_rnd_buf(rndbuf, sizeof(rndbuf)); |
| 208 | rndbuf[0] = random() & 0xffffffff; | ||
| 209 | rndbuf[1] = random() & 0xffffffff; | ||
| 210 | rndbuf[2] = random() & 0xffffffff; | ||
| 211 | 209 | ||
| 212 | *clear_pwd = xs_base64_enc((char *)rndbuf, sizeof(rndbuf)); | 210 | *clear_pwd = xs_base64_enc((char *)rndbuf, sizeof(rndbuf)); |
| 213 | *hashed_pwd = hash_password(uid, *clear_pwd, NULL); | 211 | *hashed_pwd = hash_password(uid, *clear_pwd, NULL); |