From 112c77e3a1967ff7c655fd8fcc283d4b4888a5e6 Mon Sep 17 00:00:00 2001 From: Pavlo Yatsukhnenko Date: Wed, 27 Feb 2019 15:23:25 +0200 Subject: Issue #1508 Wrap all calls of `call_user_function` into `ra_call_user_function` where AUTH command sended before function call. --- redis_array_impl.c | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'redis_array_impl.c') diff --git a/redis_array_impl.c b/redis_array_impl.c index 918359c5..c879d094 100644 --- a/redis_array_impl.c +++ b/redis_array_impl.c @@ -470,7 +470,7 @@ ra_call_extractor(RedisArray *ra, const char *key, int key_len TSRMLS_DC) ZVAL_NULL(&z_ret); /* call extraction function */ ZVAL_STRINGL(&z_argv, key, key_len); - call_user_function(EG(function_table), NULL, &ra->z_fun, &z_ret, 1, &z_argv); + ra_call_user_function(EG(function_table), NULL, &ra->z_fun, &z_ret, 1, &z_argv TSRMLS_CC); if (Z_TYPE(z_ret) == IS_STRING) { out = zval_get_string(&z_ret); @@ -511,7 +511,7 @@ ra_call_distributor(RedisArray *ra, const char *key, int key_len TSRMLS_DC) ZVAL_NULL(&z_ret); /* call extraction function */ ZVAL_STRINGL(&z_argv, key, key_len); - call_user_function(EG(function_table), NULL, &ra->z_dist, &z_ret, 1, &z_argv); + ra_call_user_function(EG(function_table), NULL, &ra->z_dist, &z_ret, 1, &z_argv TSRMLS_CC); ret = (Z_TYPE(z_ret) == IS_LONG) ? Z_LVAL(z_ret) : -1; @@ -609,7 +609,7 @@ ra_index_multi(zval *z_redis, long multi_value TSRMLS_DC) { /* run MULTI */ ZVAL_STRINGL(&z_fun_multi, "MULTI", 5); ZVAL_LONG(&z_args[0], multi_value); - call_user_function(&redis_ce->function_table, z_redis, &z_fun_multi, &z_ret, 1, z_args); + ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun_multi, &z_ret, 1, z_args TSRMLS_CC); zval_dtor(&z_fun_multi); zval_dtor(&z_ret); } @@ -639,7 +639,7 @@ ra_index_change_keys(const char *cmd, zval *z_keys, zval *z_redis TSRMLS_DC) { } /* run cmd */ - call_user_function(&redis_ce->function_table, z_redis, &z_fun, &z_ret, argc, z_args); + ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun, &z_ret, argc, z_args TSRMLS_CC); zval_dtor(&z_args[0]); zval_dtor(&z_fun); @@ -695,7 +695,7 @@ ra_index_key(const char *key, int key_len, zval *z_redis TSRMLS_DC) { ZVAL_STRINGL(&z_args[1], key, key_len); /* run SADD */ - call_user_function(&redis_ce->function_table, z_redis, &z_fun_sadd, &z_ret, 2, z_args); + ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun_sadd, &z_ret, 2, z_args TSRMLS_CC); zval_dtor(&z_fun_sadd); zval_dtor(&z_args[1]); zval_dtor(&z_args[0]); @@ -709,7 +709,7 @@ ra_index_exec(zval *z_redis, zval *return_value, int keep_all TSRMLS_DC) { /* run EXEC */ ZVAL_STRINGL(&z_fun_exec, "EXEC", 4); - call_user_function(&redis_ce->function_table, z_redis, &z_fun_exec, &z_ret, 0, NULL); + ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun_exec, &z_ret, 0, NULL TSRMLS_CC); zval_dtor(&z_fun_exec); /* extract first element of exec array and put into return_value. */ @@ -736,7 +736,7 @@ ra_index_discard(zval *z_redis, zval *return_value TSRMLS_DC) { /* run DISCARD */ ZVAL_STRINGL(&z_fun_discard, "DISCARD", 7); - call_user_function(&redis_ce->function_table, z_redis, &z_fun_discard, &z_ret, 0, NULL); + ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun_discard, &z_ret, 0, NULL TSRMLS_CC); zval_dtor(&z_fun_discard); zval_dtor(&z_ret); @@ -749,7 +749,7 @@ ra_index_unwatch(zval *z_redis, zval *return_value TSRMLS_DC) { /* run UNWATCH */ ZVAL_STRINGL(&z_fun_unwatch, "UNWATCH", 7); - call_user_function(&redis_ce->function_table, z_redis, &z_fun_unwatch, &z_ret, 0, NULL); + ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun_unwatch, &z_ret, 0, NULL TSRMLS_CC); zval_dtor(&z_fun_unwatch); zval_dtor(&z_ret); @@ -789,14 +789,14 @@ ra_get_key_type(zval *z_redis, const char *key, int key_len, zval *z_from, long /* run TYPE */ ZVAL_NULL(&z_ret); ZVAL_STRINGL(&z_fun, "TYPE", 4); - call_user_function(&redis_ce->function_table, z_redis, &z_fun, &z_ret, 1, &z_arg); + ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun, &z_ret, 1, &z_arg TSRMLS_CC); zval_dtor(&z_fun); zval_dtor(&z_ret); /* run TYPE */ ZVAL_NULL(&z_ret); ZVAL_STRINGL(&z_fun, "TTL", 3); - call_user_function(&redis_ce->function_table, z_redis, &z_fun, &z_ret, 1, &z_arg); + ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun, &z_ret, 1, &z_arg TSRMLS_CC); zval_dtor(&z_fun); zval_dtor(&z_ret); @@ -828,7 +828,7 @@ ra_remove_from_index(zval *z_redis, const char *key, int key_len TSRMLS_DC) { ZVAL_STRINGL(&z_args[0], PHPREDIS_INDEX_NAME, sizeof(PHPREDIS_INDEX_NAME) - 1); ZVAL_STRINGL(&z_args[1], key, key_len); - call_user_function(&redis_ce->function_table, z_redis, &z_fun_srem, &z_ret, 2, z_args); + ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun_srem, &z_ret, 2, z_args TSRMLS_CC); /* cleanup */ zval_dtor(&z_fun_srem); @@ -850,7 +850,7 @@ ra_del_key(const char *key, int key_len, zval *z_from TSRMLS_DC) { /* run DEL on source */ ZVAL_STRINGL(&z_fun_del, "DEL", 3); ZVAL_STRINGL(&z_args[0], key, key_len); - call_user_function(&redis_ce->function_table, z_from, &z_fun_del, &z_ret, 1, z_args); + ra_call_user_function(&redis_ce->function_table, z_from, &z_fun_del, &z_ret, 1, z_args TSRMLS_CC); zval_dtor(&z_fun_del); zval_dtor(&z_args[0]); zval_dtor(&z_ret); @@ -875,7 +875,7 @@ ra_expire_key(const char *key, int key_len, zval *z_to, long ttl TSRMLS_DC) { ZVAL_STRINGL(&z_fun_expire, "EXPIRE", 6); ZVAL_STRINGL(&z_args[0], key, key_len); ZVAL_LONG(&z_args[1], ttl); - call_user_function(&redis_ce->function_table, z_to, &z_fun_expire, &z_ret, 2, z_args); + ra_call_user_function(&redis_ce->function_table, z_to, &z_fun_expire, &z_ret, 2, z_args TSRMLS_CC); zval_dtor(&z_fun_expire); zval_dtor(&z_args[0]); zval_dtor(&z_ret); @@ -899,7 +899,7 @@ ra_move_zset(const char *key, int key_len, zval *z_from, zval *z_to, long ttl TS ZVAL_STRINGL(&z_args[1], "0", 1); ZVAL_STRINGL(&z_args[2], "-1", 2); ZVAL_BOOL(&z_args[3], 1); - call_user_function(&redis_ce->function_table, z_from, &z_fun_zrange, &z_ret, 4, z_args); + ra_call_user_function(&redis_ce->function_table, z_from, &z_fun_zrange, &z_ret, 4, z_args TSRMLS_CC); zval_dtor(&z_fun_zrange); zval_dtor(&z_args[2]); zval_dtor(&z_args[1]); @@ -937,7 +937,7 @@ ra_move_zset(const char *key, int key_len, zval *z_from, zval *z_to, long ttl TS /* run ZADD on target */ ZVAL_STRINGL(&z_fun_zadd, "ZADD", 4); - call_user_function(&redis_ce->function_table, z_to, &z_fun_zadd, &z_ret_dest, 1 + 2 * count, z_zadd_args); + ra_call_user_function(&redis_ce->function_table, z_to, &z_fun_zadd, &z_ret_dest, 1 + 2 * count, z_zadd_args TSRMLS_CC); /* Expire if needed */ ra_expire_key(key, key_len, z_to, ttl TSRMLS_CC); @@ -964,7 +964,7 @@ ra_move_string(const char *key, int key_len, zval *z_from, zval *z_to, long ttl /* run GET on source */ ZVAL_STRINGL(&z_fun_get, "GET", 3); ZVAL_STRINGL(&z_args[0], key, key_len); - call_user_function(&redis_ce->function_table, z_from, &z_fun_get, &z_ret, 1, z_args); + ra_call_user_function(&redis_ce->function_table, z_from, &z_fun_get, &z_ret, 1, z_args TSRMLS_CC); zval_dtor(&z_fun_get); if(Z_TYPE(z_ret) != IS_STRING) { /* key not found or replaced */ @@ -980,14 +980,14 @@ ra_move_string(const char *key, int key_len, zval *z_from, zval *z_to, long ttl ZVAL_LONG(&z_args[1], ttl); ZVAL_STRINGL(&z_args[2], Z_STRVAL(z_ret), Z_STRLEN(z_ret)); /* copy z_ret to arg 1 */ zval_dtor(&z_ret); /* free memory from our previous call */ - call_user_function(&redis_ce->function_table, z_to, &z_fun_set, &z_ret, 3, z_args); + ra_call_user_function(&redis_ce->function_table, z_to, &z_fun_set, &z_ret, 3, z_args TSRMLS_CC); /* cleanup */ zval_dtor(&z_args[2]); } else { ZVAL_STRINGL(&z_fun_set, "SET", 3); ZVAL_STRINGL(&z_args[1], Z_STRVAL(z_ret), Z_STRLEN(z_ret)); /* copy z_ret to arg 1 */ zval_dtor(&z_ret); /* free memory from our previous return value */ - call_user_function(&redis_ce->function_table, z_to, &z_fun_set, &z_ret, 2, z_args); + ra_call_user_function(&redis_ce->function_table, z_to, &z_fun_set, &z_ret, 2, z_args TSRMLS_CC); /* cleanup */ zval_dtor(&z_args[1]); } @@ -1005,7 +1005,7 @@ ra_move_hash(const char *key, int key_len, zval *z_from, zval *z_to, long ttl TS /* run HGETALL on source */ ZVAL_STRINGL(&z_args[0], key, key_len); ZVAL_STRINGL(&z_fun_hgetall, "HGETALL", 7); - call_user_function(&redis_ce->function_table, z_from, &z_fun_hgetall, &z_args[1], 1, z_args); + ra_call_user_function(&redis_ce->function_table, z_from, &z_fun_hgetall, &z_args[1], 1, z_args TSRMLS_CC); zval_dtor(&z_fun_hgetall); if (Z_TYPE(z_args[1]) != IS_ARRAY) { /* key not found or replaced */ @@ -1017,7 +1017,7 @@ ra_move_hash(const char *key, int key_len, zval *z_from, zval *z_to, long ttl TS /* run HMSET on target */ ZVAL_STRINGL(&z_fun_hmset, "HMSET", 5); - call_user_function(&redis_ce->function_table, z_to, &z_fun_hmset, &z_ret_dest, 2, z_args); + ra_call_user_function(&redis_ce->function_table, z_to, &z_fun_hmset, &z_ret_dest, 2, z_args TSRMLS_CC); zval_dtor(&z_fun_hmset); zval_dtor(&z_ret_dest); @@ -1052,7 +1052,7 @@ ra_move_collection(const char *key, int key_len, zval *z_from, zval *z_to, ZVAL_STRING(&z_retrieve_args[i], cmd_list[i]); } - call_user_function(&redis_ce->function_table, z_from, &z_fun_retrieve, &z_ret, list_count, z_retrieve_args); + ra_call_user_function(&redis_ce->function_table, z_from, &z_fun_retrieve, &z_ret, list_count, z_retrieve_args TSRMLS_CC); /* cleanup */ zval_dtor(&z_fun_retrieve); @@ -1084,7 +1084,7 @@ ra_move_collection(const char *key, int key_len, zval *z_from, zval *z_to, /* Clean up our input return value */ zval_dtor(&z_ret); - call_user_function(&redis_ce->function_table, z_to, &z_fun_sadd, &z_ret, count, z_sadd_args); + ra_call_user_function(&redis_ce->function_table, z_to, &z_fun_sadd, &z_ret, count, z_sadd_args TSRMLS_CC); /* cleanup */ zval_dtor(&z_fun_sadd); @@ -1209,7 +1209,7 @@ ra_rehash_server(RedisArray *ra, zval *z_redis, zend_string *hostname, zend_bool ZVAL_STRING(&z_argv, "*"); } ZVAL_NULL(&z_ret); - call_user_function(&redis_ce->function_table, z_redis, &z_fun, &z_ret, 1, &z_argv); + ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun, &z_ret, 1, &z_argv TSRMLS_CC); zval_dtor(&z_argv); zval_dtor(&z_fun); -- cgit v1.2.3