From b1fc14b1ef4a731a2158189b186d73652e5180f4 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Thu, 20 Aug 2015 10:12:27 +0200 Subject: [PATCH 143/257] pw(8): Increase minimal random password length to 32 Obtained from: ElectroBSD --- usr.sbin/pw/pw_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c index 75e7fb6e5c88..85db873017bd 100644 --- a/usr.sbin/pw/pw_user.c +++ b/usr.sbin/pw/pw_user.c @@ -512,7 +512,7 @@ pw_password(struct userconf * cnf, char const * user, bool dryrun) switch (cnf->default_password) { case -1: /* Random password */ - l = (arc4random() % 8 + 8); /* 8 - 16 chars */ + l = 32 + (arc4random() % 8); /* 32 - 40 chars */ for (i = 0; i < l; i++) pwbuf[i] = chars[arc4random_uniform(sizeof(chars)-1)]; pwbuf[i] = '\0'; -- 2.11.0