From b669af0eabe602850fc02f0cdc452ce071f9adda Mon Sep 17 00:00:00 2001 From: Daniel House <76451671+daniel-house@users.noreply.github.com> Date: Wed, 10 Apr 2024 17:00:27 -0400 Subject: [PATCH] Rename 'redis_tls_ctx' and 'redis_tls_client_ctx' global variables (#268) Signed-off-by: Daniel House Signed-off-by: daniel-house Co-authored-by: Daniel House --- src/sentinel.c | 8 ++++---- src/tls.c | 34 +++++++++++++++++----------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/sentinel.c b/src/sentinel.c index ad2ebdd51..ac1039b2e 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -45,8 +45,8 @@ extern char **environ; #if USE_OPENSSL == 1 /* BUILD_YES */ -extern SSL_CTX *redis_tls_ctx; -extern SSL_CTX *redis_tls_client_ctx; +extern SSL_CTX *valkey_tls_ctx; +extern SSL_CTX *valkey_tls_client_ctx; #endif #define REDIS_SENTINEL_PORT 26379 @@ -2377,8 +2377,8 @@ void sentinelSetClientName(sentinelRedisInstance *ri, redisAsyncContext *c, char static int instanceLinkNegotiateTLS(redisAsyncContext *context) { #if USE_OPENSSL == 1 /* BUILD_YES */ - if (!redis_tls_ctx) return C_ERR; - SSL *ssl = SSL_new(redis_tls_client_ctx ? redis_tls_client_ctx : redis_tls_ctx); + if (!valkey_tls_ctx) return C_ERR; + SSL *ssl = SSL_new(valkey_tls_client_ctx ? valkey_tls_client_ctx : valkey_tls_ctx); if (!ssl) return C_ERR; if (redisInitiateSSL(&context->c, ssl) == REDIS_ERR) { diff --git a/src/tls.c b/src/tls.c index 54eaf255d..ad35ca2c2 100644 --- a/src/tls.c +++ b/src/tls.c @@ -58,8 +58,8 @@ #define REDIS_TLS_PROTO_DEFAULT (REDIS_TLS_PROTO_TLSv1_2) #endif -SSL_CTX *redis_tls_ctx = NULL; -SSL_CTX *redis_tls_client_ctx = NULL; +SSL_CTX *valkey_tls_ctx = NULL; +SSL_CTX *valkey_tls_client_ctx = NULL; static int parseProtocolsConfig(const char *str) { int i, count = 0; @@ -170,13 +170,13 @@ static void tlsInit(void) { } static void tlsCleanup(void) { - if (redis_tls_ctx) { - SSL_CTX_free(redis_tls_ctx); - redis_tls_ctx = NULL; + if (valkey_tls_ctx) { + SSL_CTX_free(valkey_tls_ctx); + valkey_tls_ctx = NULL; } - if (redis_tls_client_ctx) { - SSL_CTX_free(redis_tls_client_ctx); - redis_tls_client_ctx = NULL; + if (valkey_tls_client_ctx) { + SSL_CTX_free(valkey_tls_client_ctx); + valkey_tls_client_ctx = NULL; } #if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) @@ -284,7 +284,7 @@ error: * leave the SSL_CTX unchanged if fails. * @priv: config of serverTLSContextConfig. * @reconfigure: if true, ignore the previous configure; if false, only - * configure from @ctx_config if redis_tls_ctx is NULL. + * configure from @ctx_config if valkey_tls_ctx is NULL. */ static int tlsConfigure(void *priv, int reconfigure) { serverTLSContextConfig *ctx_config = (serverTLSContextConfig *)priv; @@ -292,7 +292,7 @@ static int tlsConfigure(void *priv, int reconfigure) { SSL_CTX *ctx = NULL; SSL_CTX *client_ctx = NULL; - if (!reconfigure && redis_tls_ctx) { + if (!reconfigure && valkey_tls_ctx) { return C_OK; } @@ -402,10 +402,10 @@ static int tlsConfigure(void *priv, int reconfigure) { if (!client_ctx) goto error; } - SSL_CTX_free(redis_tls_ctx); - SSL_CTX_free(redis_tls_client_ctx); - redis_tls_ctx = ctx; - redis_tls_client_ctx = client_ctx; + SSL_CTX_free(valkey_tls_ctx); + SSL_CTX_free(valkey_tls_client_ctx); + valkey_tls_ctx = ctx; + valkey_tls_client_ctx = client_ctx; return C_OK; @@ -457,9 +457,9 @@ typedef struct tls_connection { } tls_connection; static connection *createTLSConnection(int client_side) { - SSL_CTX *ctx = redis_tls_ctx; - if (client_side && redis_tls_client_ctx) - ctx = redis_tls_client_ctx; + SSL_CTX *ctx = valkey_tls_ctx; + if (client_side && valkey_tls_client_ctx) + ctx = valkey_tls_client_ctx; tls_connection *conn = zcalloc(sizeof(tls_connection)); conn->c.type = &CT_TLS; conn->c.fd = -1;