1
0
mirror of https://github.com/samba-team/samba.git synced 2025-11-21 12:23:50 +03:00

smbd: Use generate_nonce_buffer() in smbXsrv_open_global_allocate()

We don't need anything cryptographic for persistent file handle ids

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Volker Lendecke
2023-01-06 16:46:11 +01:00
committed by Stefan Metzmacher
parent e8abe52df2
commit a93d93a97d

View File

@@ -254,13 +254,9 @@ static NTSTATUS smbXsrv_open_global_allocate(
if (i >= min_tries && last_free != 0) {
id = last_free;
} else {
id = generate_random();
}
if (id == 0) {
id++;
}
if (id == UINT32_MAX) {
id--;
generate_nonce_buffer((uint8_t *)&id, sizeof(id));
id = MAX(id, 1);
id = MIN(id, UINT32_MAX-1);
}
key = smbXsrv_open_global_id_to_key(id, &key_buf);