Commit Graph

138 Commits

Author SHA1 Message Date
Michael Grunder b3ce048669 Fix non standards conforming prototypes. (#2150)
These now generate warnings with GCC 13
2022-09-14 22:54:22 -07:00
Pavlo Yatsukhnenko a471c87a3b Issue #2141
Fix segfault with session+tls
2022-08-21 14:59:39 +03:00
patricio.dorantes 2ff11df528 redis_session clean up ssl context. 2022-08-03 10:57:01 -05:00
patricio.dorantes d1bc672752 fix use after free, initialize on NULL 2022-08-02 17:36:54 -05:00
patricio.dorantes ed10f365e7 fix redis session standalone stream ssl context 2022-08-01 11:16:24 -05:00
michael-grunder 306fa25c19 Smaller default retry count
See #1908
2021-03-09 11:25:29 -08:00
Mike Griego 687a0b4050 Fail if session lock can't be acquired, more sane lock wait defaults, and add more logging. 2021-03-09 11:09:06 -08:00
Pavlo Yatsukhnenko a8daaff87a Issue #1782
Allow to specify stream context for rediscluster session handler.
2020-09-08 17:58:08 +03:00
Pavlo Yatsukhnenko b2cffffc10 Fix memory leak in rediscluster session handler 2020-08-14 16:56:32 +03:00
michael-grunder 066cff6ade Proper cleanup and conditional address deallocation.
See: #1807
2020-07-07 09:41:39 -07:00
michael-grunder 7fed60f248 We don't want to efree a zend_string 2020-07-06 13:16:30 -07:00
Michael Grunder ff2e160f40 Don't attempt to take ZSTR_VAL(NULL) (#1804)
Fixes #1798
2020-07-02 09:56:54 -07:00
Michael Grunder a311cc4ec3 Support for Redis 6 ACLs (#1791)
Add support for Redis 6 ACLs in the `Redis`, `RedisCluster`, and `RedisArray` classes.

On a related note, it adds a mechanism for users to customize how we generate persistent connection IDs such that they can be grouped in different ways depending on the specific use case required (e.g. it would allow connections to be grouped by username, or by user-defined persistent_id, or both).
2020-06-24 17:00:01 -07:00
Michael Grunder 5ca4141c72 Issue.1765 (#1774)
Various improvements and fixes to cluster slot caching.

* Improves slot caching so any unique set of seeds all hash to the same key

* Fix a couple of memory leaks.

* Fixes a segfault when executing a multiple key command such as `MGET` or `MSET` while the cluster is resharding.
2020-06-07 13:50:22 -07:00
Pavlo Yatsukhnenko 58dab5649f Store auth information in cluster->flags->auth 2020-06-05 10:27:48 +03:00
Pavlo Yatsukhnenko 35372a1f64 Authenticate in redis_sock_server_open 2020-03-30 22:34:12 +03:00
Tyson Andre 0ef488fca7 Remove "PHP Version 5" section
package.xml has a minimum version of 7.0
PHP 8.0 will probably be out in around a year.
2020-01-13 18:41:03 -05:00
michael-grunder 7a79ad9c27 Also protect against session.gc_maxlifetime <= 0
Addresses #1694
2020-01-10 09:47:58 -08:00
michael-grunder 3c48a332d2 Protect session.gc_maxlifetime from integer overflow 2020-01-10 09:47:58 -08:00
Tyson Andre f52bd8a853 Fix typos detected by codespell 2020-01-06 09:08:36 -05:00
Michael Booth 23b1a9d84c Enable slot caching for session cluster 2019-12-02 09:00:12 +00:00
Pavlo Yatsukhnenko 53a8bcc7a9 Issue #1657
Allow to specify schema for session handler.
2019-10-26 17:54:27 +03:00
Pavlo Yatsukhnenko 2bb086802e Issue #1631 2019-10-07 15:00:36 +03:00
Pavlo Yatsukhnenko 91a8e73441 Refactor redis_session
Use strpprintf instead of zend_string_alloc + memcpy.
2019-07-27 21:03:23 +03:00
Pavlo Yatsukhnenko 7d4470a735 Refactor redis_session
Remove `refresh_lock_status` helper function
2019-07-24 22:00:45 +03:00
Pavlo Yatsukhnenko 978c307456 Refactor redis_session
Use `redis_sock` to store `auth` and `prefix` for session.
Use `redis_sock_auth` insted of `redis_pool_member_auth`.
2019-07-23 22:16:56 +03:00
Remi Collet 943802272a cleanup TSRMLS_* usage 2019-07-09 15:26:44 +02:00
Pavlo Yatsukhnenko 5ab0e71c76 Don't check lock status in PS_UPDATE_TIMESTAMP_FUNC 2019-02-11 19:58:28 -08:00
Pavlo Yatsukhnenko 50881ddd69 Don't check the number affected keys in PS_UPDATE_TIMESTAMP_FUNC 2019-02-11 19:54:58 -08:00
michael-grunder f9928642b5 PHP 5 is dead, long live PHP 7
This commit removes support for PHP 5 by getting rid of all of our Zend
compatibility layer methods, as well as any call checking against
PHP_MAJOR_VERSION or ZEND_MODULE_API_NO.

Unit tests are all passing for Redis, RedisCluster, and RedisArray but
this should still be considered a work in progress until more testing
can be done.

Addresses issue #1448
2019-01-26 20:57:16 -08:00
Pavlo Yatsukhnenko 3aad9e653b Merge pull request #1494 from phpredis/cluster-auth2
RedisCluster auth
2019-01-21 11:57:35 +02:00
Pavlo Yatsukhnenko 35a2213d30 Merge pull request #1485 from phpredis/consistent-hashing
Implement consistent hashing algorithm for RedisArray
2019-01-21 10:57:40 +02:00
Pavlo Yatsukhnenko c5994f2a42 RedisCluster auth 2019-01-17 23:05:52 +02:00
Marius Meissner 61889cd7ba PHPREDIS-1412: Breaking the lock acquire loop in case of network problems 2018-12-27 10:30:39 +01:00
Pavlo Yatsukhnenko bb32e6f3a0 Implement consistent hashing algorithm for RedisArray 2018-12-22 15:31:51 +02:00
Pavlo Yatsukhnenko c0793e8be4 Remove unused parameter lazy_connect from redis_sock_create 2018-11-21 13:39:50 +02:00
Pavlo Yatsukhnenko 4e2de1581f Fix redis_session
Prevent infinite loop when redis_sock_server_open failed.
Check pool->lock_status.session_key is not NULL in PS_CLOSE_FUNC.
2018-11-07 17:48:58 +02:00
Pavlo Yatsukhnenko 6f7ddd275a Fix coverity scan warnings 2018-11-07 14:03:35 +02:00
Pavlo Yatsukhnenko 071a1d5476 Fix memory leak when aquiring lock 2018-11-07 10:17:30 +02:00
Michael Grunder 92f14b1480 Fix a memory leak when regenerating IDs (#1445)
Make sure we free any existing session lock key if we're going to
update it.  Otherwise we will leak that memory.
2018-11-06 21:20:06 -08:00
Pavlo Yatsukhnenko bfa6170001 Fix scan-build warnings 2018-10-01 09:44:47 +03:00
Michael Grunder 2c9e057236 Streams (#1413)
Streams API
2018-09-29 11:59:01 -07:00
Pavlo Yatsukhnenko 1d99787375 Change connect/reconnect logic
Persistant connections can be closed via close method.
Connection marked as failed only after reconnection attempts.
2018-08-22 09:02:31 +03:00
Pavlo Yatsukhnenko 7171aceaaa Issue #1367
Use `zval_get_long` instead of `Z_STRVAL_P` + `atof` for parsing
timeout and read_timeout params.
2018-07-29 22:57:03 +03:00
Hongbo Liu 1bb7fe48fa Minor refactoring 2018-06-04 09:38:35 +03:00
Hongbo Liu aaaf0f233a Add callbacks validate_sid() & update_timestamp() to session handler
Newer session handler API(PS_MOD_UPDATE_TIMESTAMP) supports 2 more callbacks:

* validate_sid() is used by session.use_strict_mode, which provides better security.
* update_timestamp() is used by session.lazy_write, which can improve performance in some situations.
2018-06-04 09:38:35 +03:00
Pavlo Yatsukhnenko 28ec432247 Issue #1358
Use `cluster_free` in `free_cluster_context` to free cluster object.
Call `cluster_disconnect` before destroying cluster object.
2018-05-31 11:24:28 +03:00
Pavlo Yatsukhnenko e17e65d531 Use zend_string for all lock_status members 2018-03-26 15:36:07 +03:00
Pavlo Yatsukhnenko 07c16e51b0 Apply zend_string API for redis_session_key 2018-03-26 14:24:33 +03:00
Pavlo Yatsukhnenko 5f75efcf95 Extra memory duplication 2018-03-24 21:48:55 +02:00