2020-08-06 15:41:58 -04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2009-2011, Salvatore Sanfilippo <antirez at gmail dot com>
|
|
|
|
* Copyright (c) 2010-2011, Pieter Noordhuis <pcnoordhuis at gmail dot com>
|
|
|
|
* Copyright (c) 2019, Redis Labs
|
|
|
|
*
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
|
*
|
|
|
|
* * Redistributions of source code must retain the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer.
|
|
|
|
* * Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* * Neither the name of Redis nor the names of its contributors may be used
|
|
|
|
* to endorse or promote products derived from this software without
|
|
|
|
* specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "hiredis.h"
|
|
|
|
#include "async.h"
|
Squashed 'deps/hiredis/' changes from f8de9a4bd..b6a052fe0
b6a052fe0 Helper for setting TCP_USER_TIMEOUT socket option (#1188)
3fa9b6944 Add RedisModule adapter (#1182)
d13c091e9 Fix wincrypt symbols conflict
5d84c8cfd Add a test ensuring we don't clobber connection error.
3f95fcdae Don't attempt to set a timeout if we are in an error state.
aacb84b8d Fix typo in makefile.
563b062e3 Accept -nan per the RESP3 spec recommendation.
04c1b5b02 Fix colliding option values
4ca8e73f6 Rework searching for openssl
cd208812f Attempt to find the correct path for openssl.
011f7093c Allow specifying the keepalive interval
e9243d4f7 Cmake static or shared (#1160)
1cbd5bc76 Write a version file for the CMake package (#1165)
6f5bae8c6 fix typo
acd09461d CMakeLists.txt: respect BUILD_SHARED_LIBS
97fcf0fd1 Add sdevent adapter
ccff093bc Bump dev version for the next release cycle.
c14775b4e Prepare for v1.1.0 GA
f0bdf8405 Add support for nan in RESP3 double (#1133)
991b0b0b3 Add an example that calls redisCommandArgv (#1140)
a36686f84 CI updates (#1139)
8ad4985e9 fix flag reference
7583ebb1b Make freeing a NULL redisAsyncContext a no op.
2c53dea7f Update version in dev branch.
f063370ed Prepare for v1.1.0-rc1
2b069573a CI fixes in preparation of release
e1e9eb40d Add author information to release-drafter template.
afc29ee1a Update for mingw cross compile
ceb8a8815 fixed cpp build error with adapters/libhv.h
3b15a04b5 Fixup of PR734: Coverage of hiredis.c (#1124)
c245df9fb CMake corrections for building on Windows (#1122)
9c338a598 Fix PUSH handler tests for Redis >= 7.0.5
6d5c3ee74 Install on windows fixes (#1117)
68b29e1ad Add timeout support to libhv adapter. (#1109)
722e3409c Additional include directory given by pkg-config (#1118)
bd9ccb8c4 Use __attribute__ when building with clang on windows
5392adc26 set default SSL certificate directory
560e66486 Minor refactor
d756f68a5 Add libhv example to our standard Makefile
a66916719 Add adapters/libhv
855b48a81 Fix pkgconfig for hiredis_ssl
79ae5ffc6 Fix protocol error (#1106)
61b5b299f Use a windows specific keepalive function. (#1104)
fce8abc1c Introduce .close method for redisContextFuncs
cfb6ca881 Add REDIS_OPT_PREFER_UNSPEC (#1101)
cc7c35ce6 Update documentation to explain redisConnectWithOptions.
bc8d837b7 fix heap-buffer-overflow (#957)
ca4a0e850 uvadapter: reduce number of uv_poll_start calls
35d398c90 Fix cmake config path on Linux. CMake config files were installed to `/usr/local/share/hiredis`, which is not recognizable by `find_package()`. I'm not sure why it was set that way. Given the commit introducing it is for Windows, I keep that behavior consistent there, but fix the rest.
10c78c6e1 Add possibility to prefer IPv6, IPv4 or unspecified
1abe0c828 fuzzer: No alloc in redisFormatCommand() when fail
329eaf9ba Fix heap-buffer-overflow issue in redisvFormatCommad
eaae7321c Polling adapter requires sockcompat.h
0a5fa3dde Regression test for off-by-one parsing error
9e174e8f7 Add do while(0) protection for macros
4ad99c69a Rework asSleep to be a generic millisleep function.
75cb6c1ea Do store command timeout in the context for redisSetTimeout (#593)
c57cad658 CMake: remove dict.c form hiredis_sources
8491a65a9 Add Github Actions CI workflow for hiredis: Arm, Arm64, 386, windows. (#943)
77e4f09ea Merge pull request #964 from afcidk/fix-createDoubleObject
9219f7e7c Merge pull request #901 from devnexen/illumos_test_fix
810cc6104 Merge pull request #905 from sundb/master
df8b74d69 Merge pull request #1091 from redis/ssl-error-ub-fix
0ed6cdec3 Fix some undefined behaviour
507a6dcaa Merge pull request #1090 from Nordix/subscribe-oom-error
b044eaa6a Copy error to redisAsyncContext when finding subscribe cb
e0200b797 Merge pull request #1087 from redis/const-and-non-const-callback
6a3e96ad2 Maintain backward compatibiliy withour onConnect callback.
e7afd998f Merge pull request #1079 from SukkaW/drop-macos-10.15-runner
17c8fe079 Merge pull request #931 from kristjanvalur/pr2
b808c0c20 Merge pull request #1083 from chayim/ck-drafter
367a82bf0 Merge pull request #1085 from stanhu/ssl-improve-options-setting
71119a71d Make it possible to set SSL verify mode
dd7979ac1 Merge pull request #1084 from stanhu/sh-improve-ssl-docs
c71116178 Improve example for SSL initialization in README.md
5c9b6b571 Release drafter
a606ccf2a CI: use recommended `vmactions/freebsd-vm@v0`
0865c115b Merge pull request #1080 from Nordix/readme-corrections
f6cee7142 Fix README typos
06be7ff31 Merge pull request #1050 from smmir-cent/fix-cmake-version
7dd833d54 CI: bump macos runner version
f69fac769 Drop `const` on redisAsyncContext in redisConnectCallback Since the callback is now re-entrant, it can call apis such as redisAsyncDisconnect()
005d7edeb Support calling redisAsyncDisconnect from the onConnected callback, by deferring context deletion
6ed060920 Add async regression test for issue #931
eaa2a7ee7 Merge pull request #932 from kristjanvalur/pr3
2ccef30f3 Add regression test for issue #945
4b901d44a Initial async tests
31c91408e Polling adapter and example
8a15f4d65 Merge pull request #1057 from orgads/static-name
902dd047f Merge pull request #1054 from kristjanvalur/pr08
c78d0926b Merge pull request #1074 from michael-grunder/kristjanvalur-pr4
2b115d56c Whitespace
1343988ce Fix typos
47b57aa24 Add some documentation on connect/disconnect callbacks and command callbacks
a890d9ce2 Merge pull request #1073 from michael-grunder/kristjanvalur-pr1
f246ee433 Whitespace, style
94c1985bd Use correct type for getsockopt()
5e002bc21 Support failed async connects on windows.
5d68ad2f4 Merge pull request #1072 from michael-grunder/fix-redis7-unit-tests
f4b6ed289 Fix tests so they work for Redis 7.0
95a0c1283 Merge pull request #1058 from orgads/win64
eedb37a65 Fix warnings on Win64
47c3ecefc Merge pull request #1062 from yossigo/fix-push-notification-order
e23d91c97 Merge pull request #1061 from yossigo/update-redis-apt
34211ad54 Merge pull request #1063 from redis/fix-windows-tests
9957af7e3 Whitelist hiredis repo path in cygwin
b455b3381 Handle push notifications before or after reply.
aed9ce446 Use official repository for redis package.
d7683f35a Merge pull request #1047 from Nordix/unsubscribe-handling
7c44a9d7e Merge pull request #1045 from Nordix/sds-updates
dd4bf9783 Use the same name for static and shared libraries
ff57c18b9 Embed debug information in windows static lib, rather than create a .pdb file
8310ad4f5 fix cmake version
7123b87f6 Handle any pipelined unsubscribe in async
b6fb548fc Ignore pubsub replies without a channel/pattern
00b82683b Handle overflows as errors instead of asserting
64062a1d4 Catch size_t overflows in sds.c
066c6de79 Use size_t/long to avoid truncation
c6657ef65 Merge branch 'redis:master' into master
50cdcab49 Fix potential fault at createDoubleObject
fd033e983 Remove semicolon after do-while in _EL_CLEANUP
664c415e7 Illumos test fixes, error message difference fot bad hostname test.
git-subtree-dir: deps/hiredis
git-subtree-split: b6a052fe0959dae69e16b9d74449faeb1b70dbe1
2023-05-30 15:23:45 -04:00
|
|
|
#include "net.h"
|
2020-08-06 15:41:58 -04:00
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
|
|
|
#ifdef _WIN32
|
|
|
|
#include <windows.h>
|
2022-02-14 06:51:42 -05:00
|
|
|
#include <wincrypt.h>
|
Squashed 'deps/hiredis/' changes from f8de9a4bd..b6a052fe0
b6a052fe0 Helper for setting TCP_USER_TIMEOUT socket option (#1188)
3fa9b6944 Add RedisModule adapter (#1182)
d13c091e9 Fix wincrypt symbols conflict
5d84c8cfd Add a test ensuring we don't clobber connection error.
3f95fcdae Don't attempt to set a timeout if we are in an error state.
aacb84b8d Fix typo in makefile.
563b062e3 Accept -nan per the RESP3 spec recommendation.
04c1b5b02 Fix colliding option values
4ca8e73f6 Rework searching for openssl
cd208812f Attempt to find the correct path for openssl.
011f7093c Allow specifying the keepalive interval
e9243d4f7 Cmake static or shared (#1160)
1cbd5bc76 Write a version file for the CMake package (#1165)
6f5bae8c6 fix typo
acd09461d CMakeLists.txt: respect BUILD_SHARED_LIBS
97fcf0fd1 Add sdevent adapter
ccff093bc Bump dev version for the next release cycle.
c14775b4e Prepare for v1.1.0 GA
f0bdf8405 Add support for nan in RESP3 double (#1133)
991b0b0b3 Add an example that calls redisCommandArgv (#1140)
a36686f84 CI updates (#1139)
8ad4985e9 fix flag reference
7583ebb1b Make freeing a NULL redisAsyncContext a no op.
2c53dea7f Update version in dev branch.
f063370ed Prepare for v1.1.0-rc1
2b069573a CI fixes in preparation of release
e1e9eb40d Add author information to release-drafter template.
afc29ee1a Update for mingw cross compile
ceb8a8815 fixed cpp build error with adapters/libhv.h
3b15a04b5 Fixup of PR734: Coverage of hiredis.c (#1124)
c245df9fb CMake corrections for building on Windows (#1122)
9c338a598 Fix PUSH handler tests for Redis >= 7.0.5
6d5c3ee74 Install on windows fixes (#1117)
68b29e1ad Add timeout support to libhv adapter. (#1109)
722e3409c Additional include directory given by pkg-config (#1118)
bd9ccb8c4 Use __attribute__ when building with clang on windows
5392adc26 set default SSL certificate directory
560e66486 Minor refactor
d756f68a5 Add libhv example to our standard Makefile
a66916719 Add adapters/libhv
855b48a81 Fix pkgconfig for hiredis_ssl
79ae5ffc6 Fix protocol error (#1106)
61b5b299f Use a windows specific keepalive function. (#1104)
fce8abc1c Introduce .close method for redisContextFuncs
cfb6ca881 Add REDIS_OPT_PREFER_UNSPEC (#1101)
cc7c35ce6 Update documentation to explain redisConnectWithOptions.
bc8d837b7 fix heap-buffer-overflow (#957)
ca4a0e850 uvadapter: reduce number of uv_poll_start calls
35d398c90 Fix cmake config path on Linux. CMake config files were installed to `/usr/local/share/hiredis`, which is not recognizable by `find_package()`. I'm not sure why it was set that way. Given the commit introducing it is for Windows, I keep that behavior consistent there, but fix the rest.
10c78c6e1 Add possibility to prefer IPv6, IPv4 or unspecified
1abe0c828 fuzzer: No alloc in redisFormatCommand() when fail
329eaf9ba Fix heap-buffer-overflow issue in redisvFormatCommad
eaae7321c Polling adapter requires sockcompat.h
0a5fa3dde Regression test for off-by-one parsing error
9e174e8f7 Add do while(0) protection for macros
4ad99c69a Rework asSleep to be a generic millisleep function.
75cb6c1ea Do store command timeout in the context for redisSetTimeout (#593)
c57cad658 CMake: remove dict.c form hiredis_sources
8491a65a9 Add Github Actions CI workflow for hiredis: Arm, Arm64, 386, windows. (#943)
77e4f09ea Merge pull request #964 from afcidk/fix-createDoubleObject
9219f7e7c Merge pull request #901 from devnexen/illumos_test_fix
810cc6104 Merge pull request #905 from sundb/master
df8b74d69 Merge pull request #1091 from redis/ssl-error-ub-fix
0ed6cdec3 Fix some undefined behaviour
507a6dcaa Merge pull request #1090 from Nordix/subscribe-oom-error
b044eaa6a Copy error to redisAsyncContext when finding subscribe cb
e0200b797 Merge pull request #1087 from redis/const-and-non-const-callback
6a3e96ad2 Maintain backward compatibiliy withour onConnect callback.
e7afd998f Merge pull request #1079 from SukkaW/drop-macos-10.15-runner
17c8fe079 Merge pull request #931 from kristjanvalur/pr2
b808c0c20 Merge pull request #1083 from chayim/ck-drafter
367a82bf0 Merge pull request #1085 from stanhu/ssl-improve-options-setting
71119a71d Make it possible to set SSL verify mode
dd7979ac1 Merge pull request #1084 from stanhu/sh-improve-ssl-docs
c71116178 Improve example for SSL initialization in README.md
5c9b6b571 Release drafter
a606ccf2a CI: use recommended `vmactions/freebsd-vm@v0`
0865c115b Merge pull request #1080 from Nordix/readme-corrections
f6cee7142 Fix README typos
06be7ff31 Merge pull request #1050 from smmir-cent/fix-cmake-version
7dd833d54 CI: bump macos runner version
f69fac769 Drop `const` on redisAsyncContext in redisConnectCallback Since the callback is now re-entrant, it can call apis such as redisAsyncDisconnect()
005d7edeb Support calling redisAsyncDisconnect from the onConnected callback, by deferring context deletion
6ed060920 Add async regression test for issue #931
eaa2a7ee7 Merge pull request #932 from kristjanvalur/pr3
2ccef30f3 Add regression test for issue #945
4b901d44a Initial async tests
31c91408e Polling adapter and example
8a15f4d65 Merge pull request #1057 from orgads/static-name
902dd047f Merge pull request #1054 from kristjanvalur/pr08
c78d0926b Merge pull request #1074 from michael-grunder/kristjanvalur-pr4
2b115d56c Whitespace
1343988ce Fix typos
47b57aa24 Add some documentation on connect/disconnect callbacks and command callbacks
a890d9ce2 Merge pull request #1073 from michael-grunder/kristjanvalur-pr1
f246ee433 Whitespace, style
94c1985bd Use correct type for getsockopt()
5e002bc21 Support failed async connects on windows.
5d68ad2f4 Merge pull request #1072 from michael-grunder/fix-redis7-unit-tests
f4b6ed289 Fix tests so they work for Redis 7.0
95a0c1283 Merge pull request #1058 from orgads/win64
eedb37a65 Fix warnings on Win64
47c3ecefc Merge pull request #1062 from yossigo/fix-push-notification-order
e23d91c97 Merge pull request #1061 from yossigo/update-redis-apt
34211ad54 Merge pull request #1063 from redis/fix-windows-tests
9957af7e3 Whitelist hiredis repo path in cygwin
b455b3381 Handle push notifications before or after reply.
aed9ce446 Use official repository for redis package.
d7683f35a Merge pull request #1047 from Nordix/unsubscribe-handling
7c44a9d7e Merge pull request #1045 from Nordix/sds-updates
dd4bf9783 Use the same name for static and shared libraries
ff57c18b9 Embed debug information in windows static lib, rather than create a .pdb file
8310ad4f5 fix cmake version
7123b87f6 Handle any pipelined unsubscribe in async
b6fb548fc Ignore pubsub replies without a channel/pattern
00b82683b Handle overflows as errors instead of asserting
64062a1d4 Catch size_t overflows in sds.c
066c6de79 Use size_t/long to avoid truncation
c6657ef65 Merge branch 'redis:master' into master
50cdcab49 Fix potential fault at createDoubleObject
fd033e983 Remove semicolon after do-while in _EL_CLEANUP
664c415e7 Illumos test fixes, error message difference fot bad hostname test.
git-subtree-dir: deps/hiredis
git-subtree-split: b6a052fe0959dae69e16b9d74449faeb1b70dbe1
2023-05-30 15:23:45 -04:00
|
|
|
#ifdef OPENSSL_IS_BORINGSSL
|
|
|
|
#undef X509_NAME
|
|
|
|
#undef X509_EXTENSIONS
|
|
|
|
#undef PKCS7_ISSUER_AND_SERIAL
|
|
|
|
#undef PKCS7_SIGNER_INFO
|
|
|
|
#undef OCSP_REQUEST
|
|
|
|
#undef OCSP_RESPONSE
|
|
|
|
#endif
|
2020-08-06 15:41:58 -04:00
|
|
|
#else
|
|
|
|
#include <pthread.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <openssl/ssl.h>
|
|
|
|
#include <openssl/err.h>
|
|
|
|
|
|
|
|
#include "win32.h"
|
|
|
|
#include "async_private.h"
|
|
|
|
#include "hiredis_ssl.h"
|
|
|
|
|
2023-07-13 02:23:10 -04:00
|
|
|
#define OPENSSL_1_1_0 0x10100000L
|
|
|
|
|
2020-08-06 15:41:58 -04:00
|
|
|
void __redisSetError(redisContext *c, int type, const char *str);
|
|
|
|
|
|
|
|
struct redisSSLContext {
|
|
|
|
/* Associated OpenSSL SSL_CTX as created by redisCreateSSLContext() */
|
|
|
|
SSL_CTX *ssl_ctx;
|
|
|
|
|
|
|
|
/* Requested SNI, or NULL */
|
|
|
|
char *server_name;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* The SSL connection context is attached to SSL/TLS connections as a privdata. */
|
|
|
|
typedef struct redisSSL {
|
|
|
|
/**
|
|
|
|
* OpenSSL SSL object.
|
|
|
|
*/
|
|
|
|
SSL *ssl;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SSL_write() requires to be called again with the same arguments it was
|
|
|
|
* previously called with in the event of an SSL_read/SSL_write situation
|
|
|
|
*/
|
|
|
|
size_t lastLen;
|
|
|
|
|
|
|
|
/** Whether the SSL layer requires read (possibly before a write) */
|
|
|
|
int wantRead;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether a write was requested prior to a read. If set, the write()
|
|
|
|
* should resume whenever a read takes place, if possible
|
|
|
|
*/
|
|
|
|
int pendingWrite;
|
|
|
|
} redisSSL;
|
|
|
|
|
|
|
|
/* Forward declaration */
|
|
|
|
redisContextFuncs redisContextSSLFuncs;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* OpenSSL global initialization and locking handling callbacks.
|
|
|
|
* Note that this is only required for OpenSSL < 1.1.0.
|
|
|
|
*/
|
|
|
|
|
2023-07-13 02:23:10 -04:00
|
|
|
#if OPENSSL_VERSION_NUMBER < OPENSSL_1_1_0
|
2020-08-06 15:41:58 -04:00
|
|
|
#define HIREDIS_USE_CRYPTO_LOCKS
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HIREDIS_USE_CRYPTO_LOCKS
|
|
|
|
#ifdef _WIN32
|
|
|
|
typedef CRITICAL_SECTION sslLockType;
|
|
|
|
static void sslLockInit(sslLockType* l) {
|
|
|
|
InitializeCriticalSection(l);
|
|
|
|
}
|
|
|
|
static void sslLockAcquire(sslLockType* l) {
|
|
|
|
EnterCriticalSection(l);
|
|
|
|
}
|
|
|
|
static void sslLockRelease(sslLockType* l) {
|
|
|
|
LeaveCriticalSection(l);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
typedef pthread_mutex_t sslLockType;
|
|
|
|
static void sslLockInit(sslLockType *l) {
|
|
|
|
pthread_mutex_init(l, NULL);
|
|
|
|
}
|
|
|
|
static void sslLockAcquire(sslLockType *l) {
|
|
|
|
pthread_mutex_lock(l);
|
|
|
|
}
|
|
|
|
static void sslLockRelease(sslLockType *l) {
|
|
|
|
pthread_mutex_unlock(l);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static sslLockType* ossl_locks;
|
|
|
|
|
|
|
|
static void opensslDoLock(int mode, int lkid, const char *f, int line) {
|
|
|
|
sslLockType *l = ossl_locks + lkid;
|
|
|
|
|
|
|
|
if (mode & CRYPTO_LOCK) {
|
|
|
|
sslLockAcquire(l);
|
|
|
|
} else {
|
|
|
|
sslLockRelease(l);
|
|
|
|
}
|
|
|
|
|
|
|
|
(void)f;
|
|
|
|
(void)line;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int initOpensslLocks(void) {
|
|
|
|
unsigned ii, nlocks;
|
|
|
|
if (CRYPTO_get_locking_callback() != NULL) {
|
|
|
|
/* Someone already set the callback before us. Don't destroy it! */
|
|
|
|
return REDIS_OK;
|
|
|
|
}
|
|
|
|
nlocks = CRYPTO_num_locks();
|
|
|
|
ossl_locks = hi_malloc(sizeof(*ossl_locks) * nlocks);
|
|
|
|
if (ossl_locks == NULL)
|
|
|
|
return REDIS_ERR;
|
|
|
|
|
|
|
|
for (ii = 0; ii < nlocks; ii++) {
|
|
|
|
sslLockInit(ossl_locks + ii);
|
|
|
|
}
|
|
|
|
CRYPTO_set_locking_callback(opensslDoLock);
|
|
|
|
return REDIS_OK;
|
|
|
|
}
|
|
|
|
#endif /* HIREDIS_USE_CRYPTO_LOCKS */
|
|
|
|
|
|
|
|
int redisInitOpenSSL(void)
|
|
|
|
{
|
|
|
|
SSL_library_init();
|
|
|
|
#ifdef HIREDIS_USE_CRYPTO_LOCKS
|
|
|
|
initOpensslLocks();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return REDIS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* redisSSLContext helper context destruction.
|
|
|
|
*/
|
|
|
|
|
|
|
|
const char *redisSSLContextGetError(redisSSLContextError error)
|
|
|
|
{
|
|
|
|
switch (error) {
|
|
|
|
case REDIS_SSL_CTX_NONE:
|
|
|
|
return "No Error";
|
|
|
|
case REDIS_SSL_CTX_CREATE_FAILED:
|
|
|
|
return "Failed to create OpenSSL SSL_CTX";
|
|
|
|
case REDIS_SSL_CTX_CERT_KEY_REQUIRED:
|
|
|
|
return "Client cert and key must both be specified or skipped";
|
|
|
|
case REDIS_SSL_CTX_CA_CERT_LOAD_FAILED:
|
|
|
|
return "Failed to load CA Certificate or CA Path";
|
|
|
|
case REDIS_SSL_CTX_CLIENT_CERT_LOAD_FAILED:
|
|
|
|
return "Failed to load client certificate";
|
|
|
|
case REDIS_SSL_CTX_PRIVATE_KEY_LOAD_FAILED:
|
|
|
|
return "Failed to load private key";
|
2022-02-14 06:51:42 -05:00
|
|
|
case REDIS_SSL_CTX_OS_CERTSTORE_OPEN_FAILED:
|
2022-06-15 06:37:39 -04:00
|
|
|
return "Failed to open system certificate store";
|
2022-02-14 06:51:42 -05:00
|
|
|
case REDIS_SSL_CTX_OS_CERT_ADD_FAILED:
|
|
|
|
return "Failed to add CA certificates obtained from system to the SSL context";
|
2020-08-06 15:41:58 -04:00
|
|
|
default:
|
|
|
|
return "Unknown error code";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void redisFreeSSLContext(redisSSLContext *ctx)
|
|
|
|
{
|
|
|
|
if (!ctx)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (ctx->server_name) {
|
|
|
|
hi_free(ctx->server_name);
|
|
|
|
ctx->server_name = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ctx->ssl_ctx) {
|
|
|
|
SSL_CTX_free(ctx->ssl_ctx);
|
|
|
|
ctx->ssl_ctx = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
hi_free(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* redisSSLContext helper context initialization.
|
|
|
|
*/
|
|
|
|
|
|
|
|
redisSSLContext *redisCreateSSLContext(const char *cacert_filename, const char *capath,
|
|
|
|
const char *cert_filename, const char *private_key_filename,
|
|
|
|
const char *server_name, redisSSLContextError *error)
|
|
|
|
{
|
Squashed 'deps/hiredis/' changes from f8de9a4bd..b6a052fe0
b6a052fe0 Helper for setting TCP_USER_TIMEOUT socket option (#1188)
3fa9b6944 Add RedisModule adapter (#1182)
d13c091e9 Fix wincrypt symbols conflict
5d84c8cfd Add a test ensuring we don't clobber connection error.
3f95fcdae Don't attempt to set a timeout if we are in an error state.
aacb84b8d Fix typo in makefile.
563b062e3 Accept -nan per the RESP3 spec recommendation.
04c1b5b02 Fix colliding option values
4ca8e73f6 Rework searching for openssl
cd208812f Attempt to find the correct path for openssl.
011f7093c Allow specifying the keepalive interval
e9243d4f7 Cmake static or shared (#1160)
1cbd5bc76 Write a version file for the CMake package (#1165)
6f5bae8c6 fix typo
acd09461d CMakeLists.txt: respect BUILD_SHARED_LIBS
97fcf0fd1 Add sdevent adapter
ccff093bc Bump dev version for the next release cycle.
c14775b4e Prepare for v1.1.0 GA
f0bdf8405 Add support for nan in RESP3 double (#1133)
991b0b0b3 Add an example that calls redisCommandArgv (#1140)
a36686f84 CI updates (#1139)
8ad4985e9 fix flag reference
7583ebb1b Make freeing a NULL redisAsyncContext a no op.
2c53dea7f Update version in dev branch.
f063370ed Prepare for v1.1.0-rc1
2b069573a CI fixes in preparation of release
e1e9eb40d Add author information to release-drafter template.
afc29ee1a Update for mingw cross compile
ceb8a8815 fixed cpp build error with adapters/libhv.h
3b15a04b5 Fixup of PR734: Coverage of hiredis.c (#1124)
c245df9fb CMake corrections for building on Windows (#1122)
9c338a598 Fix PUSH handler tests for Redis >= 7.0.5
6d5c3ee74 Install on windows fixes (#1117)
68b29e1ad Add timeout support to libhv adapter. (#1109)
722e3409c Additional include directory given by pkg-config (#1118)
bd9ccb8c4 Use __attribute__ when building with clang on windows
5392adc26 set default SSL certificate directory
560e66486 Minor refactor
d756f68a5 Add libhv example to our standard Makefile
a66916719 Add adapters/libhv
855b48a81 Fix pkgconfig for hiredis_ssl
79ae5ffc6 Fix protocol error (#1106)
61b5b299f Use a windows specific keepalive function. (#1104)
fce8abc1c Introduce .close method for redisContextFuncs
cfb6ca881 Add REDIS_OPT_PREFER_UNSPEC (#1101)
cc7c35ce6 Update documentation to explain redisConnectWithOptions.
bc8d837b7 fix heap-buffer-overflow (#957)
ca4a0e850 uvadapter: reduce number of uv_poll_start calls
35d398c90 Fix cmake config path on Linux. CMake config files were installed to `/usr/local/share/hiredis`, which is not recognizable by `find_package()`. I'm not sure why it was set that way. Given the commit introducing it is for Windows, I keep that behavior consistent there, but fix the rest.
10c78c6e1 Add possibility to prefer IPv6, IPv4 or unspecified
1abe0c828 fuzzer: No alloc in redisFormatCommand() when fail
329eaf9ba Fix heap-buffer-overflow issue in redisvFormatCommad
eaae7321c Polling adapter requires sockcompat.h
0a5fa3dde Regression test for off-by-one parsing error
9e174e8f7 Add do while(0) protection for macros
4ad99c69a Rework asSleep to be a generic millisleep function.
75cb6c1ea Do store command timeout in the context for redisSetTimeout (#593)
c57cad658 CMake: remove dict.c form hiredis_sources
8491a65a9 Add Github Actions CI workflow for hiredis: Arm, Arm64, 386, windows. (#943)
77e4f09ea Merge pull request #964 from afcidk/fix-createDoubleObject
9219f7e7c Merge pull request #901 from devnexen/illumos_test_fix
810cc6104 Merge pull request #905 from sundb/master
df8b74d69 Merge pull request #1091 from redis/ssl-error-ub-fix
0ed6cdec3 Fix some undefined behaviour
507a6dcaa Merge pull request #1090 from Nordix/subscribe-oom-error
b044eaa6a Copy error to redisAsyncContext when finding subscribe cb
e0200b797 Merge pull request #1087 from redis/const-and-non-const-callback
6a3e96ad2 Maintain backward compatibiliy withour onConnect callback.
e7afd998f Merge pull request #1079 from SukkaW/drop-macos-10.15-runner
17c8fe079 Merge pull request #931 from kristjanvalur/pr2
b808c0c20 Merge pull request #1083 from chayim/ck-drafter
367a82bf0 Merge pull request #1085 from stanhu/ssl-improve-options-setting
71119a71d Make it possible to set SSL verify mode
dd7979ac1 Merge pull request #1084 from stanhu/sh-improve-ssl-docs
c71116178 Improve example for SSL initialization in README.md
5c9b6b571 Release drafter
a606ccf2a CI: use recommended `vmactions/freebsd-vm@v0`
0865c115b Merge pull request #1080 from Nordix/readme-corrections
f6cee7142 Fix README typos
06be7ff31 Merge pull request #1050 from smmir-cent/fix-cmake-version
7dd833d54 CI: bump macos runner version
f69fac769 Drop `const` on redisAsyncContext in redisConnectCallback Since the callback is now re-entrant, it can call apis such as redisAsyncDisconnect()
005d7edeb Support calling redisAsyncDisconnect from the onConnected callback, by deferring context deletion
6ed060920 Add async regression test for issue #931
eaa2a7ee7 Merge pull request #932 from kristjanvalur/pr3
2ccef30f3 Add regression test for issue #945
4b901d44a Initial async tests
31c91408e Polling adapter and example
8a15f4d65 Merge pull request #1057 from orgads/static-name
902dd047f Merge pull request #1054 from kristjanvalur/pr08
c78d0926b Merge pull request #1074 from michael-grunder/kristjanvalur-pr4
2b115d56c Whitespace
1343988ce Fix typos
47b57aa24 Add some documentation on connect/disconnect callbacks and command callbacks
a890d9ce2 Merge pull request #1073 from michael-grunder/kristjanvalur-pr1
f246ee433 Whitespace, style
94c1985bd Use correct type for getsockopt()
5e002bc21 Support failed async connects on windows.
5d68ad2f4 Merge pull request #1072 from michael-grunder/fix-redis7-unit-tests
f4b6ed289 Fix tests so they work for Redis 7.0
95a0c1283 Merge pull request #1058 from orgads/win64
eedb37a65 Fix warnings on Win64
47c3ecefc Merge pull request #1062 from yossigo/fix-push-notification-order
e23d91c97 Merge pull request #1061 from yossigo/update-redis-apt
34211ad54 Merge pull request #1063 from redis/fix-windows-tests
9957af7e3 Whitelist hiredis repo path in cygwin
b455b3381 Handle push notifications before or after reply.
aed9ce446 Use official repository for redis package.
d7683f35a Merge pull request #1047 from Nordix/unsubscribe-handling
7c44a9d7e Merge pull request #1045 from Nordix/sds-updates
dd4bf9783 Use the same name for static and shared libraries
ff57c18b9 Embed debug information in windows static lib, rather than create a .pdb file
8310ad4f5 fix cmake version
7123b87f6 Handle any pipelined unsubscribe in async
b6fb548fc Ignore pubsub replies without a channel/pattern
00b82683b Handle overflows as errors instead of asserting
64062a1d4 Catch size_t overflows in sds.c
066c6de79 Use size_t/long to avoid truncation
c6657ef65 Merge branch 'redis:master' into master
50cdcab49 Fix potential fault at createDoubleObject
fd033e983 Remove semicolon after do-while in _EL_CLEANUP
664c415e7 Illumos test fixes, error message difference fot bad hostname test.
git-subtree-dir: deps/hiredis
git-subtree-split: b6a052fe0959dae69e16b9d74449faeb1b70dbe1
2023-05-30 15:23:45 -04:00
|
|
|
redisSSLOptions options = {
|
|
|
|
.cacert_filename = cacert_filename,
|
|
|
|
.capath = capath,
|
|
|
|
.cert_filename = cert_filename,
|
|
|
|
.private_key_filename = private_key_filename,
|
|
|
|
.server_name = server_name,
|
|
|
|
.verify_mode = REDIS_SSL_VERIFY_PEER,
|
|
|
|
};
|
|
|
|
|
|
|
|
return redisCreateSSLContextWithOptions(&options, error);
|
|
|
|
}
|
|
|
|
|
|
|
|
redisSSLContext *redisCreateSSLContextWithOptions(redisSSLOptions *options, redisSSLContextError *error) {
|
|
|
|
const char *cacert_filename = options->cacert_filename;
|
|
|
|
const char *capath = options->capath;
|
|
|
|
const char *cert_filename = options->cert_filename;
|
|
|
|
const char *private_key_filename = options->private_key_filename;
|
|
|
|
const char *server_name = options->server_name;
|
|
|
|
|
2022-02-14 06:51:42 -05:00
|
|
|
#ifdef _WIN32
|
|
|
|
HCERTSTORE win_store = NULL;
|
|
|
|
PCCERT_CONTEXT win_ctx = NULL;
|
|
|
|
#endif
|
|
|
|
|
2020-08-06 15:41:58 -04:00
|
|
|
redisSSLContext *ctx = hi_calloc(1, sizeof(redisSSLContext));
|
|
|
|
if (ctx == NULL)
|
|
|
|
goto error;
|
|
|
|
|
2023-07-13 02:23:10 -04:00
|
|
|
const SSL_METHOD *ssl_method;
|
|
|
|
#if OPENSSL_VERSION_NUMBER >= OPENSSL_1_1_0
|
|
|
|
ssl_method = TLS_client_method();
|
|
|
|
#else
|
|
|
|
ssl_method = SSLv23_client_method();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
ctx->ssl_ctx = SSL_CTX_new(ssl_method);
|
2020-08-06 15:41:58 -04:00
|
|
|
if (!ctx->ssl_ctx) {
|
|
|
|
if (error) *error = REDIS_SSL_CTX_CREATE_FAILED;
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2023-07-13 02:23:10 -04:00
|
|
|
#if OPENSSL_VERSION_NUMBER >= OPENSSL_1_1_0
|
|
|
|
SSL_CTX_set_min_proto_version(ctx->ssl_ctx, TLS1_2_VERSION);
|
|
|
|
#else
|
|
|
|
SSL_CTX_set_options(ctx->ssl_ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1);
|
|
|
|
#endif
|
|
|
|
|
Squashed 'deps/hiredis/' changes from f8de9a4bd..b6a052fe0
b6a052fe0 Helper for setting TCP_USER_TIMEOUT socket option (#1188)
3fa9b6944 Add RedisModule adapter (#1182)
d13c091e9 Fix wincrypt symbols conflict
5d84c8cfd Add a test ensuring we don't clobber connection error.
3f95fcdae Don't attempt to set a timeout if we are in an error state.
aacb84b8d Fix typo in makefile.
563b062e3 Accept -nan per the RESP3 spec recommendation.
04c1b5b02 Fix colliding option values
4ca8e73f6 Rework searching for openssl
cd208812f Attempt to find the correct path for openssl.
011f7093c Allow specifying the keepalive interval
e9243d4f7 Cmake static or shared (#1160)
1cbd5bc76 Write a version file for the CMake package (#1165)
6f5bae8c6 fix typo
acd09461d CMakeLists.txt: respect BUILD_SHARED_LIBS
97fcf0fd1 Add sdevent adapter
ccff093bc Bump dev version for the next release cycle.
c14775b4e Prepare for v1.1.0 GA
f0bdf8405 Add support for nan in RESP3 double (#1133)
991b0b0b3 Add an example that calls redisCommandArgv (#1140)
a36686f84 CI updates (#1139)
8ad4985e9 fix flag reference
7583ebb1b Make freeing a NULL redisAsyncContext a no op.
2c53dea7f Update version in dev branch.
f063370ed Prepare for v1.1.0-rc1
2b069573a CI fixes in preparation of release
e1e9eb40d Add author information to release-drafter template.
afc29ee1a Update for mingw cross compile
ceb8a8815 fixed cpp build error with adapters/libhv.h
3b15a04b5 Fixup of PR734: Coverage of hiredis.c (#1124)
c245df9fb CMake corrections for building on Windows (#1122)
9c338a598 Fix PUSH handler tests for Redis >= 7.0.5
6d5c3ee74 Install on windows fixes (#1117)
68b29e1ad Add timeout support to libhv adapter. (#1109)
722e3409c Additional include directory given by pkg-config (#1118)
bd9ccb8c4 Use __attribute__ when building with clang on windows
5392adc26 set default SSL certificate directory
560e66486 Minor refactor
d756f68a5 Add libhv example to our standard Makefile
a66916719 Add adapters/libhv
855b48a81 Fix pkgconfig for hiredis_ssl
79ae5ffc6 Fix protocol error (#1106)
61b5b299f Use a windows specific keepalive function. (#1104)
fce8abc1c Introduce .close method for redisContextFuncs
cfb6ca881 Add REDIS_OPT_PREFER_UNSPEC (#1101)
cc7c35ce6 Update documentation to explain redisConnectWithOptions.
bc8d837b7 fix heap-buffer-overflow (#957)
ca4a0e850 uvadapter: reduce number of uv_poll_start calls
35d398c90 Fix cmake config path on Linux. CMake config files were installed to `/usr/local/share/hiredis`, which is not recognizable by `find_package()`. I'm not sure why it was set that way. Given the commit introducing it is for Windows, I keep that behavior consistent there, but fix the rest.
10c78c6e1 Add possibility to prefer IPv6, IPv4 or unspecified
1abe0c828 fuzzer: No alloc in redisFormatCommand() when fail
329eaf9ba Fix heap-buffer-overflow issue in redisvFormatCommad
eaae7321c Polling adapter requires sockcompat.h
0a5fa3dde Regression test for off-by-one parsing error
9e174e8f7 Add do while(0) protection for macros
4ad99c69a Rework asSleep to be a generic millisleep function.
75cb6c1ea Do store command timeout in the context for redisSetTimeout (#593)
c57cad658 CMake: remove dict.c form hiredis_sources
8491a65a9 Add Github Actions CI workflow for hiredis: Arm, Arm64, 386, windows. (#943)
77e4f09ea Merge pull request #964 from afcidk/fix-createDoubleObject
9219f7e7c Merge pull request #901 from devnexen/illumos_test_fix
810cc6104 Merge pull request #905 from sundb/master
df8b74d69 Merge pull request #1091 from redis/ssl-error-ub-fix
0ed6cdec3 Fix some undefined behaviour
507a6dcaa Merge pull request #1090 from Nordix/subscribe-oom-error
b044eaa6a Copy error to redisAsyncContext when finding subscribe cb
e0200b797 Merge pull request #1087 from redis/const-and-non-const-callback
6a3e96ad2 Maintain backward compatibiliy withour onConnect callback.
e7afd998f Merge pull request #1079 from SukkaW/drop-macos-10.15-runner
17c8fe079 Merge pull request #931 from kristjanvalur/pr2
b808c0c20 Merge pull request #1083 from chayim/ck-drafter
367a82bf0 Merge pull request #1085 from stanhu/ssl-improve-options-setting
71119a71d Make it possible to set SSL verify mode
dd7979ac1 Merge pull request #1084 from stanhu/sh-improve-ssl-docs
c71116178 Improve example for SSL initialization in README.md
5c9b6b571 Release drafter
a606ccf2a CI: use recommended `vmactions/freebsd-vm@v0`
0865c115b Merge pull request #1080 from Nordix/readme-corrections
f6cee7142 Fix README typos
06be7ff31 Merge pull request #1050 from smmir-cent/fix-cmake-version
7dd833d54 CI: bump macos runner version
f69fac769 Drop `const` on redisAsyncContext in redisConnectCallback Since the callback is now re-entrant, it can call apis such as redisAsyncDisconnect()
005d7edeb Support calling redisAsyncDisconnect from the onConnected callback, by deferring context deletion
6ed060920 Add async regression test for issue #931
eaa2a7ee7 Merge pull request #932 from kristjanvalur/pr3
2ccef30f3 Add regression test for issue #945
4b901d44a Initial async tests
31c91408e Polling adapter and example
8a15f4d65 Merge pull request #1057 from orgads/static-name
902dd047f Merge pull request #1054 from kristjanvalur/pr08
c78d0926b Merge pull request #1074 from michael-grunder/kristjanvalur-pr4
2b115d56c Whitespace
1343988ce Fix typos
47b57aa24 Add some documentation on connect/disconnect callbacks and command callbacks
a890d9ce2 Merge pull request #1073 from michael-grunder/kristjanvalur-pr1
f246ee433 Whitespace, style
94c1985bd Use correct type for getsockopt()
5e002bc21 Support failed async connects on windows.
5d68ad2f4 Merge pull request #1072 from michael-grunder/fix-redis7-unit-tests
f4b6ed289 Fix tests so they work for Redis 7.0
95a0c1283 Merge pull request #1058 from orgads/win64
eedb37a65 Fix warnings on Win64
47c3ecefc Merge pull request #1062 from yossigo/fix-push-notification-order
e23d91c97 Merge pull request #1061 from yossigo/update-redis-apt
34211ad54 Merge pull request #1063 from redis/fix-windows-tests
9957af7e3 Whitelist hiredis repo path in cygwin
b455b3381 Handle push notifications before or after reply.
aed9ce446 Use official repository for redis package.
d7683f35a Merge pull request #1047 from Nordix/unsubscribe-handling
7c44a9d7e Merge pull request #1045 from Nordix/sds-updates
dd4bf9783 Use the same name for static and shared libraries
ff57c18b9 Embed debug information in windows static lib, rather than create a .pdb file
8310ad4f5 fix cmake version
7123b87f6 Handle any pipelined unsubscribe in async
b6fb548fc Ignore pubsub replies without a channel/pattern
00b82683b Handle overflows as errors instead of asserting
64062a1d4 Catch size_t overflows in sds.c
066c6de79 Use size_t/long to avoid truncation
c6657ef65 Merge branch 'redis:master' into master
50cdcab49 Fix potential fault at createDoubleObject
fd033e983 Remove semicolon after do-while in _EL_CLEANUP
664c415e7 Illumos test fixes, error message difference fot bad hostname test.
git-subtree-dir: deps/hiredis
git-subtree-split: b6a052fe0959dae69e16b9d74449faeb1b70dbe1
2023-05-30 15:23:45 -04:00
|
|
|
SSL_CTX_set_verify(ctx->ssl_ctx, options->verify_mode, NULL);
|
2020-08-06 15:41:58 -04:00
|
|
|
|
|
|
|
if ((cert_filename != NULL && private_key_filename == NULL) ||
|
|
|
|
(private_key_filename != NULL && cert_filename == NULL)) {
|
|
|
|
if (error) *error = REDIS_SSL_CTX_CERT_KEY_REQUIRED;
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (capath || cacert_filename) {
|
2022-02-14 06:51:42 -05:00
|
|
|
#ifdef _WIN32
|
|
|
|
if (0 == strcmp(cacert_filename, "wincert")) {
|
|
|
|
win_store = CertOpenSystemStore(NULL, "Root");
|
|
|
|
if (!win_store) {
|
|
|
|
if (error) *error = REDIS_SSL_CTX_OS_CERTSTORE_OPEN_FAILED;
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
X509_STORE* store = SSL_CTX_get_cert_store(ctx->ssl_ctx);
|
|
|
|
while (win_ctx = CertEnumCertificatesInStore(win_store, win_ctx)) {
|
|
|
|
X509* x509 = NULL;
|
|
|
|
x509 = d2i_X509(NULL, (const unsigned char**)&win_ctx->pbCertEncoded, win_ctx->cbCertEncoded);
|
|
|
|
if (x509) {
|
|
|
|
if ((1 != X509_STORE_add_cert(store, x509)) ||
|
|
|
|
(1 != SSL_CTX_add_client_CA(ctx->ssl_ctx, x509)))
|
|
|
|
{
|
|
|
|
if (error) *error = REDIS_SSL_CTX_OS_CERT_ADD_FAILED;
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
X509_free(x509);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CertFreeCertificateContext(win_ctx);
|
|
|
|
CertCloseStore(win_store, 0);
|
|
|
|
} else
|
|
|
|
#endif
|
2020-08-06 15:41:58 -04:00
|
|
|
if (!SSL_CTX_load_verify_locations(ctx->ssl_ctx, cacert_filename, capath)) {
|
|
|
|
if (error) *error = REDIS_SSL_CTX_CA_CERT_LOAD_FAILED;
|
|
|
|
goto error;
|
|
|
|
}
|
Squashed 'deps/hiredis/' changes from f8de9a4bd..b6a052fe0
b6a052fe0 Helper for setting TCP_USER_TIMEOUT socket option (#1188)
3fa9b6944 Add RedisModule adapter (#1182)
d13c091e9 Fix wincrypt symbols conflict
5d84c8cfd Add a test ensuring we don't clobber connection error.
3f95fcdae Don't attempt to set a timeout if we are in an error state.
aacb84b8d Fix typo in makefile.
563b062e3 Accept -nan per the RESP3 spec recommendation.
04c1b5b02 Fix colliding option values
4ca8e73f6 Rework searching for openssl
cd208812f Attempt to find the correct path for openssl.
011f7093c Allow specifying the keepalive interval
e9243d4f7 Cmake static or shared (#1160)
1cbd5bc76 Write a version file for the CMake package (#1165)
6f5bae8c6 fix typo
acd09461d CMakeLists.txt: respect BUILD_SHARED_LIBS
97fcf0fd1 Add sdevent adapter
ccff093bc Bump dev version for the next release cycle.
c14775b4e Prepare for v1.1.0 GA
f0bdf8405 Add support for nan in RESP3 double (#1133)
991b0b0b3 Add an example that calls redisCommandArgv (#1140)
a36686f84 CI updates (#1139)
8ad4985e9 fix flag reference
7583ebb1b Make freeing a NULL redisAsyncContext a no op.
2c53dea7f Update version in dev branch.
f063370ed Prepare for v1.1.0-rc1
2b069573a CI fixes in preparation of release
e1e9eb40d Add author information to release-drafter template.
afc29ee1a Update for mingw cross compile
ceb8a8815 fixed cpp build error with adapters/libhv.h
3b15a04b5 Fixup of PR734: Coverage of hiredis.c (#1124)
c245df9fb CMake corrections for building on Windows (#1122)
9c338a598 Fix PUSH handler tests for Redis >= 7.0.5
6d5c3ee74 Install on windows fixes (#1117)
68b29e1ad Add timeout support to libhv adapter. (#1109)
722e3409c Additional include directory given by pkg-config (#1118)
bd9ccb8c4 Use __attribute__ when building with clang on windows
5392adc26 set default SSL certificate directory
560e66486 Minor refactor
d756f68a5 Add libhv example to our standard Makefile
a66916719 Add adapters/libhv
855b48a81 Fix pkgconfig for hiredis_ssl
79ae5ffc6 Fix protocol error (#1106)
61b5b299f Use a windows specific keepalive function. (#1104)
fce8abc1c Introduce .close method for redisContextFuncs
cfb6ca881 Add REDIS_OPT_PREFER_UNSPEC (#1101)
cc7c35ce6 Update documentation to explain redisConnectWithOptions.
bc8d837b7 fix heap-buffer-overflow (#957)
ca4a0e850 uvadapter: reduce number of uv_poll_start calls
35d398c90 Fix cmake config path on Linux. CMake config files were installed to `/usr/local/share/hiredis`, which is not recognizable by `find_package()`. I'm not sure why it was set that way. Given the commit introducing it is for Windows, I keep that behavior consistent there, but fix the rest.
10c78c6e1 Add possibility to prefer IPv6, IPv4 or unspecified
1abe0c828 fuzzer: No alloc in redisFormatCommand() when fail
329eaf9ba Fix heap-buffer-overflow issue in redisvFormatCommad
eaae7321c Polling adapter requires sockcompat.h
0a5fa3dde Regression test for off-by-one parsing error
9e174e8f7 Add do while(0) protection for macros
4ad99c69a Rework asSleep to be a generic millisleep function.
75cb6c1ea Do store command timeout in the context for redisSetTimeout (#593)
c57cad658 CMake: remove dict.c form hiredis_sources
8491a65a9 Add Github Actions CI workflow for hiredis: Arm, Arm64, 386, windows. (#943)
77e4f09ea Merge pull request #964 from afcidk/fix-createDoubleObject
9219f7e7c Merge pull request #901 from devnexen/illumos_test_fix
810cc6104 Merge pull request #905 from sundb/master
df8b74d69 Merge pull request #1091 from redis/ssl-error-ub-fix
0ed6cdec3 Fix some undefined behaviour
507a6dcaa Merge pull request #1090 from Nordix/subscribe-oom-error
b044eaa6a Copy error to redisAsyncContext when finding subscribe cb
e0200b797 Merge pull request #1087 from redis/const-and-non-const-callback
6a3e96ad2 Maintain backward compatibiliy withour onConnect callback.
e7afd998f Merge pull request #1079 from SukkaW/drop-macos-10.15-runner
17c8fe079 Merge pull request #931 from kristjanvalur/pr2
b808c0c20 Merge pull request #1083 from chayim/ck-drafter
367a82bf0 Merge pull request #1085 from stanhu/ssl-improve-options-setting
71119a71d Make it possible to set SSL verify mode
dd7979ac1 Merge pull request #1084 from stanhu/sh-improve-ssl-docs
c71116178 Improve example for SSL initialization in README.md
5c9b6b571 Release drafter
a606ccf2a CI: use recommended `vmactions/freebsd-vm@v0`
0865c115b Merge pull request #1080 from Nordix/readme-corrections
f6cee7142 Fix README typos
06be7ff31 Merge pull request #1050 from smmir-cent/fix-cmake-version
7dd833d54 CI: bump macos runner version
f69fac769 Drop `const` on redisAsyncContext in redisConnectCallback Since the callback is now re-entrant, it can call apis such as redisAsyncDisconnect()
005d7edeb Support calling redisAsyncDisconnect from the onConnected callback, by deferring context deletion
6ed060920 Add async regression test for issue #931
eaa2a7ee7 Merge pull request #932 from kristjanvalur/pr3
2ccef30f3 Add regression test for issue #945
4b901d44a Initial async tests
31c91408e Polling adapter and example
8a15f4d65 Merge pull request #1057 from orgads/static-name
902dd047f Merge pull request #1054 from kristjanvalur/pr08
c78d0926b Merge pull request #1074 from michael-grunder/kristjanvalur-pr4
2b115d56c Whitespace
1343988ce Fix typos
47b57aa24 Add some documentation on connect/disconnect callbacks and command callbacks
a890d9ce2 Merge pull request #1073 from michael-grunder/kristjanvalur-pr1
f246ee433 Whitespace, style
94c1985bd Use correct type for getsockopt()
5e002bc21 Support failed async connects on windows.
5d68ad2f4 Merge pull request #1072 from michael-grunder/fix-redis7-unit-tests
f4b6ed289 Fix tests so they work for Redis 7.0
95a0c1283 Merge pull request #1058 from orgads/win64
eedb37a65 Fix warnings on Win64
47c3ecefc Merge pull request #1062 from yossigo/fix-push-notification-order
e23d91c97 Merge pull request #1061 from yossigo/update-redis-apt
34211ad54 Merge pull request #1063 from redis/fix-windows-tests
9957af7e3 Whitelist hiredis repo path in cygwin
b455b3381 Handle push notifications before or after reply.
aed9ce446 Use official repository for redis package.
d7683f35a Merge pull request #1047 from Nordix/unsubscribe-handling
7c44a9d7e Merge pull request #1045 from Nordix/sds-updates
dd4bf9783 Use the same name for static and shared libraries
ff57c18b9 Embed debug information in windows static lib, rather than create a .pdb file
8310ad4f5 fix cmake version
7123b87f6 Handle any pipelined unsubscribe in async
b6fb548fc Ignore pubsub replies without a channel/pattern
00b82683b Handle overflows as errors instead of asserting
64062a1d4 Catch size_t overflows in sds.c
066c6de79 Use size_t/long to avoid truncation
c6657ef65 Merge branch 'redis:master' into master
50cdcab49 Fix potential fault at createDoubleObject
fd033e983 Remove semicolon after do-while in _EL_CLEANUP
664c415e7 Illumos test fixes, error message difference fot bad hostname test.
git-subtree-dir: deps/hiredis
git-subtree-split: b6a052fe0959dae69e16b9d74449faeb1b70dbe1
2023-05-30 15:23:45 -04:00
|
|
|
} else {
|
|
|
|
if (!SSL_CTX_set_default_verify_paths(ctx->ssl_ctx)) {
|
|
|
|
if (error) *error = REDIS_SSL_CTX_CLIENT_DEFAULT_CERT_FAILED;
|
|
|
|
goto error;
|
|
|
|
}
|
2020-08-06 15:41:58 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (cert_filename) {
|
|
|
|
if (!SSL_CTX_use_certificate_chain_file(ctx->ssl_ctx, cert_filename)) {
|
|
|
|
if (error) *error = REDIS_SSL_CTX_CLIENT_CERT_LOAD_FAILED;
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
if (!SSL_CTX_use_PrivateKey_file(ctx->ssl_ctx, private_key_filename, SSL_FILETYPE_PEM)) {
|
|
|
|
if (error) *error = REDIS_SSL_CTX_PRIVATE_KEY_LOAD_FAILED;
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (server_name)
|
|
|
|
ctx->server_name = hi_strdup(server_name);
|
|
|
|
|
|
|
|
return ctx;
|
|
|
|
|
|
|
|
error:
|
2022-02-14 06:51:42 -05:00
|
|
|
#ifdef _WIN32
|
|
|
|
CertFreeCertificateContext(win_ctx);
|
|
|
|
CertCloseStore(win_store, 0);
|
|
|
|
#endif
|
2020-08-06 15:41:58 -04:00
|
|
|
redisFreeSSLContext(ctx);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SSL Connection initialization.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
static int redisSSLConnect(redisContext *c, SSL *ssl) {
|
|
|
|
if (c->privctx) {
|
|
|
|
__redisSetError(c, REDIS_ERR_OTHER, "redisContext was already associated");
|
|
|
|
return REDIS_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
redisSSL *rssl = hi_calloc(1, sizeof(redisSSL));
|
|
|
|
if (rssl == NULL) {
|
|
|
|
__redisSetError(c, REDIS_ERR_OOM, "Out of memory");
|
|
|
|
return REDIS_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
c->funcs = &redisContextSSLFuncs;
|
|
|
|
rssl->ssl = ssl;
|
|
|
|
|
|
|
|
SSL_set_mode(rssl->ssl, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
|
|
|
|
SSL_set_fd(rssl->ssl, c->fd);
|
|
|
|
SSL_set_connect_state(rssl->ssl);
|
|
|
|
|
|
|
|
ERR_clear_error();
|
|
|
|
int rv = SSL_connect(rssl->ssl);
|
|
|
|
if (rv == 1) {
|
|
|
|
c->privctx = rssl;
|
|
|
|
return REDIS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
rv = SSL_get_error(rssl->ssl, rv);
|
|
|
|
if (((c->flags & REDIS_BLOCK) == 0) &&
|
|
|
|
(rv == SSL_ERROR_WANT_READ || rv == SSL_ERROR_WANT_WRITE)) {
|
|
|
|
c->privctx = rssl;
|
|
|
|
return REDIS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (c->err == 0) {
|
|
|
|
char err[512];
|
|
|
|
if (rv == SSL_ERROR_SYSCALL)
|
|
|
|
snprintf(err,sizeof(err)-1,"SSL_connect failed: %s",strerror(errno));
|
|
|
|
else {
|
|
|
|
unsigned long e = ERR_peek_last_error();
|
|
|
|
snprintf(err,sizeof(err)-1,"SSL_connect failed: %s",
|
|
|
|
ERR_reason_error_string(e));
|
|
|
|
}
|
|
|
|
__redisSetError(c, REDIS_ERR_IO, err);
|
|
|
|
}
|
|
|
|
|
|
|
|
hi_free(rssl);
|
|
|
|
return REDIS_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A wrapper around redisSSLConnect() for users who manage their own context and
|
|
|
|
* create their own SSL object.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int redisInitiateSSL(redisContext *c, SSL *ssl) {
|
|
|
|
return redisSSLConnect(c, ssl);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A wrapper around redisSSLConnect() for users who use redisSSLContext and don't
|
|
|
|
* manage their own SSL objects.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int redisInitiateSSLWithContext(redisContext *c, redisSSLContext *redis_ssl_ctx)
|
|
|
|
{
|
|
|
|
if (!c || !redis_ssl_ctx)
|
|
|
|
return REDIS_ERR;
|
|
|
|
|
|
|
|
/* We want to verify that redisSSLConnect() won't fail on this, as it will
|
|
|
|
* not own the SSL object in that case and we'll end up leaking.
|
|
|
|
*/
|
|
|
|
if (c->privctx)
|
|
|
|
return REDIS_ERR;
|
|
|
|
|
|
|
|
SSL *ssl = SSL_new(redis_ssl_ctx->ssl_ctx);
|
|
|
|
if (!ssl) {
|
|
|
|
__redisSetError(c, REDIS_ERR_OTHER, "Couldn't create new SSL instance");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (redis_ssl_ctx->server_name) {
|
|
|
|
if (!SSL_set_tlsext_host_name(ssl, redis_ssl_ctx->server_name)) {
|
|
|
|
__redisSetError(c, REDIS_ERR_OTHER, "Failed to set server_name/SNI");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-14 06:51:42 -05:00
|
|
|
if (redisSSLConnect(c, ssl) != REDIS_OK) {
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
return REDIS_OK;
|
2020-08-06 15:41:58 -04:00
|
|
|
|
|
|
|
error:
|
|
|
|
if (ssl)
|
|
|
|
SSL_free(ssl);
|
|
|
|
return REDIS_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int maybeCheckWant(redisSSL *rssl, int rv) {
|
|
|
|
/**
|
|
|
|
* If the error is WANT_READ or WANT_WRITE, the appropriate flags are set
|
|
|
|
* and true is returned. False is returned otherwise
|
|
|
|
*/
|
|
|
|
if (rv == SSL_ERROR_WANT_READ) {
|
|
|
|
rssl->wantRead = 1;
|
|
|
|
return 1;
|
|
|
|
} else if (rv == SSL_ERROR_WANT_WRITE) {
|
|
|
|
rssl->pendingWrite = 1;
|
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implementation of redisContextFuncs for SSL connections.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void redisSSLFree(void *privctx){
|
|
|
|
redisSSL *rsc = privctx;
|
|
|
|
|
|
|
|
if (!rsc) return;
|
|
|
|
if (rsc->ssl) {
|
|
|
|
SSL_free(rsc->ssl);
|
|
|
|
rsc->ssl = NULL;
|
|
|
|
}
|
|
|
|
hi_free(rsc);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t redisSSLRead(redisContext *c, char *buf, size_t bufcap) {
|
|
|
|
redisSSL *rssl = c->privctx;
|
|
|
|
|
|
|
|
int nread = SSL_read(rssl->ssl, buf, bufcap);
|
|
|
|
if (nread > 0) {
|
|
|
|
return nread;
|
|
|
|
} else if (nread == 0) {
|
|
|
|
__redisSetError(c, REDIS_ERR_EOF, "Server closed the connection");
|
|
|
|
return -1;
|
|
|
|
} else {
|
|
|
|
int err = SSL_get_error(rssl->ssl, nread);
|
|
|
|
if (c->flags & REDIS_BLOCK) {
|
|
|
|
/**
|
|
|
|
* In blocking mode, we should never end up in a situation where
|
|
|
|
* we get an error without it being an actual error, except
|
|
|
|
* in the case of EINTR, which can be spuriously received from
|
|
|
|
* debuggers or whatever.
|
|
|
|
*/
|
|
|
|
if (errno == EINTR) {
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
const char *msg = NULL;
|
|
|
|
if (errno == EAGAIN) {
|
|
|
|
msg = "Resource temporarily unavailable";
|
|
|
|
}
|
|
|
|
__redisSetError(c, REDIS_ERR_IO, msg);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* We can very well get an EWOULDBLOCK/EAGAIN, however
|
|
|
|
*/
|
|
|
|
if (maybeCheckWant(rssl, err)) {
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
__redisSetError(c, REDIS_ERR_IO, NULL);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t redisSSLWrite(redisContext *c) {
|
|
|
|
redisSSL *rssl = c->privctx;
|
|
|
|
|
2020-08-15 15:24:31 -04:00
|
|
|
size_t len = rssl->lastLen ? rssl->lastLen : hi_sdslen(c->obuf);
|
2020-08-06 15:41:58 -04:00
|
|
|
int rv = SSL_write(rssl->ssl, c->obuf, len);
|
|
|
|
|
|
|
|
if (rv > 0) {
|
|
|
|
rssl->lastLen = 0;
|
|
|
|
} else if (rv < 0) {
|
|
|
|
rssl->lastLen = len;
|
|
|
|
|
|
|
|
int err = SSL_get_error(rssl->ssl, rv);
|
|
|
|
if ((c->flags & REDIS_BLOCK) == 0 && maybeCheckWant(rssl, err)) {
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
__redisSetError(c, REDIS_ERR_IO, NULL);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void redisSSLAsyncRead(redisAsyncContext *ac) {
|
|
|
|
int rv;
|
|
|
|
redisSSL *rssl = ac->c.privctx;
|
|
|
|
redisContext *c = &ac->c;
|
|
|
|
|
|
|
|
rssl->wantRead = 0;
|
|
|
|
|
|
|
|
if (rssl->pendingWrite) {
|
|
|
|
int done;
|
|
|
|
|
|
|
|
/* This is probably just a write event */
|
|
|
|
rssl->pendingWrite = 0;
|
|
|
|
rv = redisBufferWrite(c, &done);
|
|
|
|
if (rv == REDIS_ERR) {
|
|
|
|
__redisAsyncDisconnect(ac);
|
|
|
|
return;
|
|
|
|
} else if (!done) {
|
|
|
|
_EL_ADD_WRITE(ac);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rv = redisBufferRead(c);
|
|
|
|
if (rv == REDIS_ERR) {
|
|
|
|
__redisAsyncDisconnect(ac);
|
|
|
|
} else {
|
|
|
|
_EL_ADD_READ(ac);
|
|
|
|
redisProcessCallbacks(ac);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void redisSSLAsyncWrite(redisAsyncContext *ac) {
|
|
|
|
int rv, done = 0;
|
|
|
|
redisSSL *rssl = ac->c.privctx;
|
|
|
|
redisContext *c = &ac->c;
|
|
|
|
|
|
|
|
rssl->pendingWrite = 0;
|
|
|
|
rv = redisBufferWrite(c, &done);
|
|
|
|
if (rv == REDIS_ERR) {
|
|
|
|
__redisAsyncDisconnect(ac);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!done) {
|
|
|
|
if (rssl->wantRead) {
|
|
|
|
/* Need to read-before-write */
|
|
|
|
rssl->pendingWrite = 1;
|
|
|
|
_EL_DEL_WRITE(ac);
|
|
|
|
} else {
|
|
|
|
/* No extra reads needed, just need to write more */
|
|
|
|
_EL_ADD_WRITE(ac);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* Already done! */
|
|
|
|
_EL_DEL_WRITE(ac);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Always reschedule a read */
|
|
|
|
_EL_ADD_READ(ac);
|
|
|
|
}
|
|
|
|
|
|
|
|
redisContextFuncs redisContextSSLFuncs = {
|
Squashed 'deps/hiredis/' changes from f8de9a4bd..b6a052fe0
b6a052fe0 Helper for setting TCP_USER_TIMEOUT socket option (#1188)
3fa9b6944 Add RedisModule adapter (#1182)
d13c091e9 Fix wincrypt symbols conflict
5d84c8cfd Add a test ensuring we don't clobber connection error.
3f95fcdae Don't attempt to set a timeout if we are in an error state.
aacb84b8d Fix typo in makefile.
563b062e3 Accept -nan per the RESP3 spec recommendation.
04c1b5b02 Fix colliding option values
4ca8e73f6 Rework searching for openssl
cd208812f Attempt to find the correct path for openssl.
011f7093c Allow specifying the keepalive interval
e9243d4f7 Cmake static or shared (#1160)
1cbd5bc76 Write a version file for the CMake package (#1165)
6f5bae8c6 fix typo
acd09461d CMakeLists.txt: respect BUILD_SHARED_LIBS
97fcf0fd1 Add sdevent adapter
ccff093bc Bump dev version for the next release cycle.
c14775b4e Prepare for v1.1.0 GA
f0bdf8405 Add support for nan in RESP3 double (#1133)
991b0b0b3 Add an example that calls redisCommandArgv (#1140)
a36686f84 CI updates (#1139)
8ad4985e9 fix flag reference
7583ebb1b Make freeing a NULL redisAsyncContext a no op.
2c53dea7f Update version in dev branch.
f063370ed Prepare for v1.1.0-rc1
2b069573a CI fixes in preparation of release
e1e9eb40d Add author information to release-drafter template.
afc29ee1a Update for mingw cross compile
ceb8a8815 fixed cpp build error with adapters/libhv.h
3b15a04b5 Fixup of PR734: Coverage of hiredis.c (#1124)
c245df9fb CMake corrections for building on Windows (#1122)
9c338a598 Fix PUSH handler tests for Redis >= 7.0.5
6d5c3ee74 Install on windows fixes (#1117)
68b29e1ad Add timeout support to libhv adapter. (#1109)
722e3409c Additional include directory given by pkg-config (#1118)
bd9ccb8c4 Use __attribute__ when building with clang on windows
5392adc26 set default SSL certificate directory
560e66486 Minor refactor
d756f68a5 Add libhv example to our standard Makefile
a66916719 Add adapters/libhv
855b48a81 Fix pkgconfig for hiredis_ssl
79ae5ffc6 Fix protocol error (#1106)
61b5b299f Use a windows specific keepalive function. (#1104)
fce8abc1c Introduce .close method for redisContextFuncs
cfb6ca881 Add REDIS_OPT_PREFER_UNSPEC (#1101)
cc7c35ce6 Update documentation to explain redisConnectWithOptions.
bc8d837b7 fix heap-buffer-overflow (#957)
ca4a0e850 uvadapter: reduce number of uv_poll_start calls
35d398c90 Fix cmake config path on Linux. CMake config files were installed to `/usr/local/share/hiredis`, which is not recognizable by `find_package()`. I'm not sure why it was set that way. Given the commit introducing it is for Windows, I keep that behavior consistent there, but fix the rest.
10c78c6e1 Add possibility to prefer IPv6, IPv4 or unspecified
1abe0c828 fuzzer: No alloc in redisFormatCommand() when fail
329eaf9ba Fix heap-buffer-overflow issue in redisvFormatCommad
eaae7321c Polling adapter requires sockcompat.h
0a5fa3dde Regression test for off-by-one parsing error
9e174e8f7 Add do while(0) protection for macros
4ad99c69a Rework asSleep to be a generic millisleep function.
75cb6c1ea Do store command timeout in the context for redisSetTimeout (#593)
c57cad658 CMake: remove dict.c form hiredis_sources
8491a65a9 Add Github Actions CI workflow for hiredis: Arm, Arm64, 386, windows. (#943)
77e4f09ea Merge pull request #964 from afcidk/fix-createDoubleObject
9219f7e7c Merge pull request #901 from devnexen/illumos_test_fix
810cc6104 Merge pull request #905 from sundb/master
df8b74d69 Merge pull request #1091 from redis/ssl-error-ub-fix
0ed6cdec3 Fix some undefined behaviour
507a6dcaa Merge pull request #1090 from Nordix/subscribe-oom-error
b044eaa6a Copy error to redisAsyncContext when finding subscribe cb
e0200b797 Merge pull request #1087 from redis/const-and-non-const-callback
6a3e96ad2 Maintain backward compatibiliy withour onConnect callback.
e7afd998f Merge pull request #1079 from SukkaW/drop-macos-10.15-runner
17c8fe079 Merge pull request #931 from kristjanvalur/pr2
b808c0c20 Merge pull request #1083 from chayim/ck-drafter
367a82bf0 Merge pull request #1085 from stanhu/ssl-improve-options-setting
71119a71d Make it possible to set SSL verify mode
dd7979ac1 Merge pull request #1084 from stanhu/sh-improve-ssl-docs
c71116178 Improve example for SSL initialization in README.md
5c9b6b571 Release drafter
a606ccf2a CI: use recommended `vmactions/freebsd-vm@v0`
0865c115b Merge pull request #1080 from Nordix/readme-corrections
f6cee7142 Fix README typos
06be7ff31 Merge pull request #1050 from smmir-cent/fix-cmake-version
7dd833d54 CI: bump macos runner version
f69fac769 Drop `const` on redisAsyncContext in redisConnectCallback Since the callback is now re-entrant, it can call apis such as redisAsyncDisconnect()
005d7edeb Support calling redisAsyncDisconnect from the onConnected callback, by deferring context deletion
6ed060920 Add async regression test for issue #931
eaa2a7ee7 Merge pull request #932 from kristjanvalur/pr3
2ccef30f3 Add regression test for issue #945
4b901d44a Initial async tests
31c91408e Polling adapter and example
8a15f4d65 Merge pull request #1057 from orgads/static-name
902dd047f Merge pull request #1054 from kristjanvalur/pr08
c78d0926b Merge pull request #1074 from michael-grunder/kristjanvalur-pr4
2b115d56c Whitespace
1343988ce Fix typos
47b57aa24 Add some documentation on connect/disconnect callbacks and command callbacks
a890d9ce2 Merge pull request #1073 from michael-grunder/kristjanvalur-pr1
f246ee433 Whitespace, style
94c1985bd Use correct type for getsockopt()
5e002bc21 Support failed async connects on windows.
5d68ad2f4 Merge pull request #1072 from michael-grunder/fix-redis7-unit-tests
f4b6ed289 Fix tests so they work for Redis 7.0
95a0c1283 Merge pull request #1058 from orgads/win64
eedb37a65 Fix warnings on Win64
47c3ecefc Merge pull request #1062 from yossigo/fix-push-notification-order
e23d91c97 Merge pull request #1061 from yossigo/update-redis-apt
34211ad54 Merge pull request #1063 from redis/fix-windows-tests
9957af7e3 Whitelist hiredis repo path in cygwin
b455b3381 Handle push notifications before or after reply.
aed9ce446 Use official repository for redis package.
d7683f35a Merge pull request #1047 from Nordix/unsubscribe-handling
7c44a9d7e Merge pull request #1045 from Nordix/sds-updates
dd4bf9783 Use the same name for static and shared libraries
ff57c18b9 Embed debug information in windows static lib, rather than create a .pdb file
8310ad4f5 fix cmake version
7123b87f6 Handle any pipelined unsubscribe in async
b6fb548fc Ignore pubsub replies without a channel/pattern
00b82683b Handle overflows as errors instead of asserting
64062a1d4 Catch size_t overflows in sds.c
066c6de79 Use size_t/long to avoid truncation
c6657ef65 Merge branch 'redis:master' into master
50cdcab49 Fix potential fault at createDoubleObject
fd033e983 Remove semicolon after do-while in _EL_CLEANUP
664c415e7 Illumos test fixes, error message difference fot bad hostname test.
git-subtree-dir: deps/hiredis
git-subtree-split: b6a052fe0959dae69e16b9d74449faeb1b70dbe1
2023-05-30 15:23:45 -04:00
|
|
|
.close = redisNetClose,
|
2020-08-06 15:41:58 -04:00
|
|
|
.free_privctx = redisSSLFree,
|
|
|
|
.async_read = redisSSLAsyncRead,
|
|
|
|
.async_write = redisSSLAsyncWrite,
|
|
|
|
.read = redisSSLRead,
|
|
|
|
.write = redisSSLWrite
|
|
|
|
};
|
|
|
|
|