diff options
author | michael-grunder <michael.grunder@gmail.com> | 2022-10-06 04:47:39 +0300 |
---|---|---|
committer | Michael Grunder <michael.grunder@gmail.com> | 2022-10-08 21:04:05 +0300 |
commit | d2044c9fa49eefecebad48aa169ab7bead1af121 (patch) | |
tree | c95f95c73c5dbbf88f7300f12e1a54aac87dc038 /redis.c | |
parent | 9a3fe401dc559e2e8fdc769c189801edaa1d3c5b (diff) |
Move where we generate our salt
Fixes #1987
Diffstat (limited to 'redis.c')
-rw-r--r-- | redis.c | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -129,7 +129,6 @@ static const zend_module_dep redis_deps[] = { }; ZEND_DECLARE_MODULE_GLOBALS(redis) -static PHP_GINIT_FUNCTION(redis); zend_module_entry redis_module_entry = { STANDARD_MODULE_HEADER_EX, @@ -144,7 +143,7 @@ zend_module_entry redis_module_entry = { PHP_MINFO(redis), PHP_REDIS_VERSION, PHP_MODULE_GLOBALS(redis), - PHP_GINIT(redis), + NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES_EX @@ -425,12 +424,6 @@ static void redis_random_hex_bytes(char *dst, size_t dstsize) { zend_string_release(s); } -static PHP_GINIT_FUNCTION(redis) -{ - redis_random_hex_bytes(redis_globals->salt, sizeof(redis_globals->salt) - 1); - redis_globals->salt[sizeof(redis_globals->salt)-1] = '\0'; -} - /** * PHP_MINIT_FUNCTION */ @@ -442,6 +435,10 @@ PHP_MINIT_FUNCTION(redis) gettimeofday(&tv, NULL); srand(tv.tv_usec * tv.tv_sec); + /* Generate our random salt */ + redis_random_hex_bytes(REDIS_G(salt), sizeof(REDIS_G(salt)) - 1); + REDIS_G(salt)[sizeof(REDIS_G(salt)) - 1] = '\0'; + REGISTER_INI_ENTRIES(); /* Redis class */ |