sniper Sun Aug 10 20:49:19 2003 EDT
Modified files:
/php-src/ext/standard basic_functions.c crypt.c
Log:
Moved the RINIT(crypt) stuff into crypt() itself.
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.621
php-src/ext/standard/basic_functions.c:1.622
--- php-src/ext/standard/basic_functions.c:1.621 Thu Aug 7 15:53:31 2003
+++ php-src/ext/standard/basic_functions.c Sun Aug 10 20:49:18 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.621 2003/08/07 19:53:31 moriyoshi Exp $ */
+/* $Id: basic_functions.c,v 1.622 2003/08/11 00:49:18 sniper Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -1191,10 +1191,6 @@
}
#endif
BG(user_shutdown_function_names) = NULL;
-
-#if HAVE_CRYPT
- PHP_RINIT(crypt)(INIT_FUNC_ARGS_PASSTHRU);
-#endif
PHP_RINIT(lcg)(INIT_FUNC_ARGS_PASSTHRU);
Index: php-src/ext/standard/crypt.c
diff -u php-src/ext/standard/crypt.c:1.57 php-src/ext/standard/crypt.c:1.58
--- php-src/ext/standard/crypt.c:1.57 Tue Jun 10 16:03:37 2003
+++ php-src/ext/standard/crypt.c Sun Aug 10 20:49:19 2003
@@ -17,7 +17,7 @@
| Rasmus Lerdorf <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: crypt.c,v 1.57 2003/06/10 20:03:37 imajes Exp $ */
+/* $Id: crypt.c,v 1.58 2003/08/11 00:49:19 sniper Exp $ */
#include <stdlib.h>
#include "php.h"
@@ -89,8 +89,6 @@
#define PHP_CRYPT_RAND php_rand(TSRMLS_C)
-static int php_crypt_rand_seeded=0;
-
PHP_MINIT_FUNCTION(crypt)
{
REGISTER_LONG_CONSTANT("CRYPT_SALT_LENGTH", PHP_MAX_SALT_LEN, CONST_CS |
CONST_PERSISTENT);
@@ -103,16 +101,6 @@
}
-PHP_RINIT_FUNCTION(crypt)
-{
- if(!php_crypt_rand_seeded) {
- php_srand(time(0) * getpid() * (unsigned long)
(php_combined_lcg(TSRMLS_C) * 10000.0) TSRMLS_CC);
- php_crypt_rand_seeded=1;
- }
- return SUCCESS;
-}
-
-
static unsigned char itoa64[] =
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
static void php_to64(char *s, long v, int n)
@@ -130,6 +118,10 @@
char salt[PHP_MAX_SALT_LEN+1];
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
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php