cvs: php-src(PHP_4_3) /ext/standard crypt.c rand.c

From: Date: Mon, 19 Jan 2004 03:16:05 +0000
Subject: cvs: php-src(PHP_4_3) /ext/standard crypt.c rand.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-25739@lists.php.net to get a copy of this message
sniper Sun Jan 18 22:16:05 2004 EDT Modified files: (Branch: PHP_4_3) /php-src/ext/standard crypt.c rand.c Log: MFH: Moved php_srand() call into php_rand(). Index: php-src/ext/standard/crypt.c diff -u php-src/ext/standard/crypt.c:1.55.8.2 php-src/ext/standard/crypt.c:1.55.8.3 --- php-src/ext/standard/crypt.c:1.55.8.2 Sun Aug 10 20:53:26 2003 +++ php-src/ext/standard/crypt.c Sun Jan 18 22:16:04 2004 @@ -17,7 +17,7 @@ | Rasmus Lerdorf <rasmus@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: crypt.c,v 1.55.8.2 2003/08/11 00:53:26 sniper Exp $ */ +/* $Id: crypt.c,v 1.55.8.3 2004/01/19 03:16:04 sniper Exp $ */ #include <stdlib.h> #include "php.h" @@ -119,10 +119,6 @@ char *str, *salt_in = NULL; int str_len, salt_in_len; - if (!BG(rand_is_seeded)) { - php_srand(GENERATE_SEED() TSRMLS_CC); - } - salt[0]=salt[PHP_MAX_SALT_LEN]='\0'; /* This will produce suitable results if people depend on DES-encryption available (passing always 2-character salt). At least for glibc6.1 */ Index: php-src/ext/standard/rand.c diff -u php-src/ext/standard/rand.c:1.60.2.2 php-src/ext/standard/rand.c:1.60.2.3 --- php-src/ext/standard/rand.c:1.60.2.2 Sun Aug 10 20:43:32 2003 +++ php-src/ext/standard/rand.c Sun Jan 18 22:16:04 2004 @@ -20,7 +20,7 @@ | Based on code from: Shawn Cokus <Cokus@math.washington.edu> | +----------------------------------------------------------------------+ */ -/* $Id: rand.c,v 1.60.2.2 2003/08/11 00:43:32 sniper Exp $ */ +/* $Id: rand.c,v 1.60.2.3 2004/01/19 03:16:04 sniper Exp $ */ #include <stdlib.h> @@ -72,6 +72,10 @@ { long ret; + if (!BG(rand_is_seeded)) { + php_srand(GENERATE_SEED() TSRMLS_CC); + } + #ifdef ZTS ret = php_rand_r(&BG(rand_seed)); #else @@ -330,10 +334,6 @@ if (argc != 0 && zend_parse_parameters(argc TSRMLS_CC, "ll", &min, &max) == FAILURE) return; - if (!BG(rand_is_seeded)) { - php_srand(GENERATE_SEED() TSRMLS_CC); - } - number = php_rand(TSRMLS_C); if (argc == 2) { RAND_RANGE(number, min, max, PHP_RAND_MAX);

« previous php.cvs (#25739) next »