1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

Replace random() and related calls with generate_random_buffer()

Result: better seeded random numbers that are cryptographically secure
(not that it matters in this case)

Please let it be right this time...

Signed-off-by: Robin McCorkell <rmccorkell@karoshi.org.uk>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Robin McCorkell 2015-07-09 15:28:05 +01:00 committed by Jeremy Allison
parent 57e2c0dfa6
commit 936a799d32
2 changed files with 4 additions and 7 deletions

View File

@ -42,13 +42,11 @@ static void shuffle_dc_set(struct dc_set *list)
{
uint32_t i;
srandom(time(NULL));
for (i = list->count; i > 1; i--) {
uint32_t r;
const char *tmp;
r = random() % i;
r = generate_random() % i;
tmp = list->names[i - 1];
list->names[i - 1] = list->names[r];

View File

@ -431,13 +431,12 @@ NTSTATUS create_conn_struct_cwd(TALLOC_CTX *ctx,
static void shuffle_strlist(char **list, int count)
{
int i, r;
int i;
uint32_t r;
char *tmp;
srandom(time(NULL));
for (i = count; i > 1; i--) {
r = random() % i;
r = generate_random() % i;
tmp = list[i-1];
list[i-1] = list[r];