summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNiels Provos <provos@cvs.openbsd.org>1998-07-05 21:08:38 +0000
committerNiels Provos <provos@cvs.openbsd.org>1998-07-05 21:08:38 +0000
commitf5a47d994d633015b1d28e0e9bfcc4c0d1454690 (patch)
treec1ce714d1f85cb63b86d399b1a8fc186ec1a316c /usr.bin
parent61db3cc2c59b8a65075d56d23e1bb07b3e0051dd (diff)
newsalt uses 24-bit count, and not 32-bit
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/passwd/pwd_gensalt.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/passwd/pwd_gensalt.c b/usr.bin/passwd/pwd_gensalt.c
index 628b94a7c6e..1000776e341 100644
--- a/usr.bin/passwd/pwd_gensalt.c
+++ b/usr.bin/passwd/pwd_gensalt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pwd_gensalt.c,v 1.8 1998/07/04 18:27:04 provos Exp $ */
+/* $OpenBSD: pwd_gensalt.c,v 1.9 1998/07/05 21:08:32 provos Exp $ */
/*
* Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
* All rights reserved.
@@ -91,10 +91,13 @@ pwd_gensalt(salt, max, pwd, type)
salt[2] = '\0';
} else if (!strcmp(now, "newsalt")) {
u_int32_t rounds = atol(next);
- if (rounds < 725)
- rounds = 725;
if (max < 10)
return 0;
+ /* Check rounds, 24 bit is max */
+ if (rounds < 7250)
+ rounds = 7250;
+ else if (rounds > 0xffffff)
+ rounds = 0xffffff;
salt[0] = _PASSWORD_EFMT1;
to64(&salt[1], (u_int32_t) rounds, 4);
to64(&salt[5], arc4random(), 4);