summaryrefslogtreecommitdiffstats
path: root/usr.bin/passwd
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1997-03-24 16:10:26 +0000
committerache <ache@FreeBSD.org>1997-03-24 16:10:26 +0000
commit64374bd80fbd7c79a98e4076e11fa4baf08d7d28 (patch)
tree799efd0c71ed124168362e549d09b52e2ddb72ca /usr.bin/passwd
parentb2a735bded453a730bace8054ea4a72b95222b8e (diff)
downloadFreeBSD-src-64374bd80fbd7c79a98e4076e11fa4baf08d7d28.zip
FreeBSD-src-64374bd80fbd7c79a98e4076e11fa4baf08d7d28.tar.gz
Initialize RNG only once
Use srandomdev() now
Diffstat (limited to 'usr.bin/passwd')
-rw-r--r--usr.bin/passwd/local_passwd.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/passwd/local_passwd.c b/usr.bin/passwd/local_passwd.c
index 92e59de..e29342b 100644
--- a/usr.bin/passwd/local_passwd.c
+++ b/usr.bin/passwd/local_passwd.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: local_passwd.c,v 1.14 1997/03/10 07:46:03 ache Exp $
+ * $Id: local_passwd.c,v 1.15 1997/03/11 14:05:35 ache Exp $
*/
#ifndef lint
@@ -70,6 +70,7 @@ static const char sccsid[] = "@(#)local_passwd.c 8.3 (Berkeley) 4/2/94";
#include "extern.h"
static uid_t uid;
+int randinit;
char *tempname;
@@ -152,7 +153,11 @@ getnewpasswd(pw, nis)
(void)printf("Mismatch; try again, EOF to quit.\n");
}
/* grab a random printable character that isn't a colon */
- (void)srandom((unsigned long)(time(NULL) ^ getpid()));
+ if (!randinit) {
+ randinit = 1;
+ if (srandomdev() < 0)
+ srandom((unsigned long)(time(NULL) ^ getpid()));
+ }
#ifdef NEWSALT
salt[0] = _PASSWORD_EFMT1;
to64(&salt[1], (long)(29 * 25), 4);
OpenPOWER on IntegriCloud