sniper Sun Aug 10 20:53:26 2003 EDT
Modified files: (Branch: PHP_4_3)
/php-src/ext/standard basic_functions.c crypt.c
Log:
MFH: moved RINIT(crypt) stuff to crypt() itself.
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.543.2.20
php-src/ext/standard/basic_functions.c:1.543.2.21
--- php-src/ext/standard/basic_functions.c:1.543.2.20 Thu Jul 24 04:04:20 2003
+++ php-src/ext/standard/basic_functions.c Sun Aug 10 20:53:26 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.543.2.20 2003/07/24 08:04:20 zeev Exp $ */
+/* $Id: basic_functions.c,v 1.543.2.21 2003/08/11 00:53:26 sniper Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -1123,10 +1123,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.55.8.1 php-src/ext/standard/crypt.c:1.55.8.2
--- php-src/ext/standard/crypt.c:1.55.8.1 Tue Dec 31 11:35:25 2002
+++ php-src/ext/standard/crypt.c Sun Aug 10 20:53:26 2003
@@ -17,7 +17,7 @@
| Rasmus Lerdorf <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: crypt.c,v 1.55.8.1 2002/12/31 16:35:25 sebastian Exp $ */
+/* $Id: crypt.c,v 1.55.8.2 2003/08/11 00:53:26 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