This is still an RC but the final version is supposed to come out in a couple of days. Committing early to catch regressions and all. Not much depends on this in ports anyway...
33 lines
827 B
Plaintext
33 lines
827 B
Plaintext
$OpenBSD: patch-kadmin_add-random-users_c,v 1.2 2016/12/17 14:58:31 ajacoutot Exp $
|
|
|
|
Use HAVE_ARC4RANDOM and choose to call arc4random() instead of srand()
|
|
and rand() and friends.
|
|
|
|
--- kadmin/add-random-users.c.orig Tue Nov 29 02:35:27 2016
|
|
+++ kadmin/add-random-users.c Thu Dec 15 11:29:38 2016
|
|
@@ -85,9 +85,13 @@ add_user (krb5_context ctx, void *hndl, unsigned nword
|
|
krb5_error_code ret;
|
|
int mask;
|
|
|
|
+#ifdef HAVE_ARC4RANDOM
|
|
+ r1 = arc4random();
|
|
+ r2 = arc4random();
|
|
+#else
|
|
r1 = rand();
|
|
r2 = rand();
|
|
-
|
|
+#endif
|
|
snprintf (name, sizeof(name), "%s%d", words[r1 % nwords], r2 % 1000);
|
|
|
|
mask = KADM5_PRINCIPAL;
|
|
@@ -169,7 +173,9 @@ main(int argc, char **argv)
|
|
print_version(NULL);
|
|
return 0;
|
|
}
|
|
+#ifndef HAVE_ARC4RANDOM
|
|
srand (0);
|
|
+#endif
|
|
argc -= optidx;
|
|
argv += optidx;
|
|
|