lib:util: Use generate_secret_buffer() for long term passwords
authorAndreas Schneider <asn@samba.org>
Mon, 12 Aug 2019 16:55:56 +0000 (18:55 +0200)
committerAlexander Bokovoy <ab@samba.org>
Wed, 14 Aug 2019 15:07:24 +0000 (15:07 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
lib/util/genrand_util.c

index d7b74c6..05d1f3e 100644 (file)
@@ -185,7 +185,7 @@ _PUBLIC_ char *generate_random_str_list(TALLOC_CTX *mem_ctx, size_t len, const c
        char *retstr = talloc_array(mem_ctx, char, len + 1);
        if (!retstr) return NULL;
 
-       generate_random_buffer((uint8_t *)retstr, len);
+       generate_secret_buffer((uint8_t *)retstr, len);
        for (i = 0; i < len; i++) {
                retstr[i] = list[retstr[i] % list_len];
        }
@@ -247,7 +247,7 @@ _PUBLIC_ char *generate_random_password(TALLOC_CTX *mem_ctx, size_t min, size_t
        if (diff > 0 ) {
                size_t tmp;
 
-               generate_random_buffer((uint8_t *)&tmp, sizeof(tmp));
+               generate_secret_buffer((uint8_t *)&tmp, sizeof(tmp));
 
                tmp %= diff;
 
@@ -317,7 +317,7 @@ _PUBLIC_ char *generate_random_machine_password(TALLOC_CTX *mem_ctx, size_t min,
        if (diff > 0) {
                size_t tmp;
 
-               generate_random_buffer((uint8_t *)&tmp, sizeof(tmp));
+               generate_secret_buffer((uint8_t *)&tmp, sizeof(tmp));
 
                tmp %= diff;