Skip to content

Commit 4faddf1

Browse files
oranagrapizhenwei
andcommitted
Build TLS as a loadable module
* Support BUILD_TLS=module to be loaded as a module via config file or command line. e.g. redis-server --loadmodule redis-tls.so * Updates to redismodule.h to allow it to be used side by side with server.h by defining REDISMODULE_CORE_MODULE * Changes to server.h, redismodule.h and module.c to avoid repeated type declarations (gcc 4.8 doesn't like these) * Add a mechanism for non-ABI neutral modules (ones who include server.h) to refuse loading if they detect not being built together with redis (release.c) * Fix wrong signature of RedisModuleDefragFunc, this could break compilation of a module, but not the ABI * Move initialization of listeners in server.c to be after loading the modules * Config TLS after initialization of listeners * Init cluster after initialization of listeners * Add TLS module to CI * Fix a test suite race conditions: Now that the listeners are initialized later, it's not sufficient to wait for the PID message in the log, we need to wait for the "Server Initialized" message. * Fix issues with moduleconfigs test as a result from start_server waiting for "Server Initialized" * Fix issues with modules/infra test as a result of an additional module present Notes about Sentinel: Sentinel can't really rely on the tls module, since it uses hiredis to initiate connections and depends on OpenSSL (won't be able to use any other connection modules for that), so it was decided that when TLS is built as a module, sentinel does not support TLS at all. This means that it keeps using redis_tls_ctx and redis_tls_client_ctx directly. Example code of config in redis-tls.so(may be use in the future): RedisModuleString *tls_cfg = NULL; void tlsInfo(RedisModuleInfoCtx *ctx, int for_crash_report) { UNUSED(for_crash_report); RedisModule_InfoAddSection(ctx, ""); RedisModule_InfoAddFieldLongLong(ctx, "var", 42); } int tlsCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) { if (argc != 2) return RedisModule_WrongArity(ctx); return RedisModule_ReplyWithString(ctx, argv[1]); } RedisModuleString *getStringConfigCommand(const char *name, void *privdata) { REDISMODULE_NOT_USED(name); REDISMODULE_NOT_USED(privdata); return tls_cfg; } int setStringConfigCommand(const char *name, RedisModuleString *new, void *privdata, RedisModuleString **err) { REDISMODULE_NOT_USED(name); REDISMODULE_NOT_USED(err); REDISMODULE_NOT_USED(privdata); if (tls_cfg) RedisModule_FreeString(NULL, tls_cfg); RedisModule_RetainString(NULL, new); tls_cfg = new; return REDISMODULE_OK; } int RedisModule_OnLoad(void *ctx, RedisModuleString **argv, int argc) { .... if (RedisModule_CreateCommand(ctx,"tls",tlsCommand,"",0,0,0) == REDISMODULE_ERR) return REDISMODULE_ERR; if (RedisModule_RegisterStringConfig(ctx, "cfg", "", REDISMODULE_CONFIG_DEFAULT, getStringConfigCommand, setStringConfigCommand, NULL, NULL) == REDISMODULE_ERR) return REDISMODULE_ERR; if (RedisModule_LoadConfigs(ctx) == REDISMODULE_ERR) { if (tls_cfg) { RedisModule_FreeString(ctx, tls_cfg); tls_cfg = NULL; } return REDISMODULE_ERR; } ... } Co-authored-by: zhenwei pi <pizhenwei@bytedance.com> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
1 parent 89e1148 commit 4faddf1

21 files changed

+302
-198
lines changed

.github/workflows/ci.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ jobs:
2424
steps:
2525
- uses: actions/checkout@v3
2626
- name: make
27-
run: make SANITIZER=address REDIS_CFLAGS='-Werror'
27+
# build with TLS module just for compilation coverage
28+
run: make SANITIZER=address REDIS_CFLAGS='-Werror' BUILD_TLS=module
2829
- name: testprep
2930
run: sudo apt-get install tcl8.6 tclx -y
3031
- name: test

.github/workflows/daily.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -539,27 +539,27 @@ jobs:
539539
run: |
540540
yum -y install centos-release-scl epel-release
541541
yum -y install devtoolset-7 openssl-devel openssl
542-
scl enable devtoolset-7 "make BUILD_TLS=yes REDIS_CFLAGS='-Werror'"
542+
scl enable devtoolset-7 "make BUILD_TLS=module REDIS_CFLAGS='-Werror'"
543543
- name: testprep
544544
run: |
545545
yum -y install tcl tcltls tclx
546546
./utils/gen-test-certs.sh
547547
- name: test
548548
if: true && !contains(github.event.inputs.skiptests, 'redis')
549549
run: |
550-
./runtest --accurate --verbose --dump-logs --tls --dump-logs ${{github.event.inputs.test_args}}
550+
./runtest --accurate --verbose --dump-logs --tls-module --dump-logs ${{github.event.inputs.test_args}}
551551
- name: module api test
552552
if: true && !contains(github.event.inputs.skiptests, 'modules')
553553
run: |
554-
./runtest-moduleapi --verbose --dump-logs --tls --dump-logs ${{github.event.inputs.test_args}}
554+
./runtest-moduleapi --verbose --dump-logs --tls-module --dump-logs ${{github.event.inputs.test_args}}
555555
- name: sentinel tests
556556
if: true && !contains(github.event.inputs.skiptests, 'sentinel')
557557
run: |
558-
./runtest-sentinel --tls ${{github.event.inputs.cluster_test_args}}
558+
./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
559559
- name: cluster tests
560560
if: true && !contains(github.event.inputs.skiptests, 'cluster')
561561
run: |
562-
./runtest-cluster --tls ${{github.event.inputs.cluster_test_args}}
562+
./runtest-cluster --tls-module ${{github.event.inputs.cluster_test_args}}
563563
564564
test-centos7-tls-no-tls:
565565
runs-on: ubuntu-latest
@@ -582,7 +582,7 @@ jobs:
582582
run: |
583583
yum -y install centos-release-scl epel-release
584584
yum -y install devtoolset-7 openssl-devel openssl
585-
scl enable devtoolset-7 "make BUILD_TLS=yes REDIS_CFLAGS='-Werror'"
585+
scl enable devtoolset-7 "make BUILD_TLS=module REDIS_CFLAGS='-Werror'"
586586
- name: testprep
587587
run: |
588588
yum -y install tcl tcltls tclx

TLS.md

+17
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,14 @@ Getting Started
99
To build with TLS support you'll need OpenSSL development libraries (e.g.
1010
libssl-dev on Debian/Ubuntu).
1111

12+
To build TLS support as Redis built-in:
1213
Run `make BUILD_TLS=yes`.
1314

15+
Or to build TLS as Redis module:
16+
Run `make BUILD_TLS=module`.
17+
18+
Note that sentinel mode does not support TLS module.
19+
1420
### Tests
1521

1622
To run Redis test suite with TLS, you'll need TLS support for TCL (i.e.
@@ -22,16 +28,27 @@ To run Redis test suite with TLS, you'll need TLS support for TCL (i.e.
2228
2. Run `./runtest --tls` or `./runtest-cluster --tls` to run Redis and Redis
2329
Cluster tests in TLS mode.
2430

31+
3. Run `./runtest --tls-module` or `./runtest-cluster --tls-module` to
32+
run Redis and Redis cluster tests in TLS mode with Redis module.
33+
2534
### Running manually
2635

2736
To manually run a Redis server with TLS mode (assuming `gen-test-certs.sh` was
2837
invoked so sample certificates/keys are available):
2938

39+
For TLS built-in mode:
3040
./src/redis-server --tls-port 6379 --port 0 \
3141
--tls-cert-file ./tests/tls/redis.crt \
3242
--tls-key-file ./tests/tls/redis.key \
3343
--tls-ca-cert-file ./tests/tls/ca.crt
3444

45+
For TLS module mode:
46+
./src/redis-server --tls-port 6379 --port 0 \
47+
--tls-cert-file ./tests/tls/redis.crt \
48+
--tls-key-file ./tests/tls/redis.key \
49+
--tls-ca-cert-file ./tests/tls/ca.crt \
50+
--loadmodule src/redis-tls.so
51+
3552
To connect to this Redis server with `redis-cli`:
3653

3754
./src/redis-cli --tls \

deps/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ distclean:
4444

4545
.PHONY: distclean
4646

47-
ifeq ($(BUILD_TLS),yes)
47+
ifneq (,$(filter $(BUILD_TLS),yes module))
4848
HIREDIS_MAKE_FLAGS = USE_SSL=1
4949
endif
5050

src/Makefile

+30-9
Original file line numberDiff line numberDiff line change
@@ -267,24 +267,41 @@ ifeq ($(MALLOC),jemalloc)
267267
FINAL_LIBS := ../deps/jemalloc/lib/libjemalloc.a $(FINAL_LIBS)
268268
endif
269269

270-
ifeq ($(BUILD_TLS),yes)
271-
FINAL_CFLAGS+=-DUSE_OPENSSL $(OPENSSL_CFLAGS)
272-
FINAL_LDFLAGS+=$(OPENSSL_LDFLAGS)
273-
LIBSSL_PKGCONFIG := $(shell $(PKG_CONFIG) --exists libssl && echo $$?)
270+
# LIBSSL & LIBCRYPTO
271+
LIBSSL_LIBS=
272+
LIBSSL_PKGCONFIG := $(shell $(PKG_CONFIG) --exists libssl && echo $$?)
274273
ifeq ($(LIBSSL_PKGCONFIG),0)
275274
LIBSSL_LIBS=$(shell $(PKG_CONFIG) --libs libssl)
276275
else
277276
LIBSSL_LIBS=-lssl
278277
endif
279-
LIBCRYPTO_PKGCONFIG := $(shell $(PKG_CONFIG) --exists libcrypto && echo $$?)
278+
LIBCRYPTO_LIBS=
279+
LIBCRYPTO_PKGCONFIG := $(shell $(PKG_CONFIG) --exists libcrypto && echo $$?)
280280
ifeq ($(LIBCRYPTO_PKGCONFIG),0)
281281
LIBCRYPTO_LIBS=$(shell $(PKG_CONFIG) --libs libcrypto)
282282
else
283283
LIBCRYPTO_LIBS=-lcrypto
284284
endif
285+
286+
BUILD_NO:=0
287+
BUILD_YES:=1
288+
BUILD_MODULE:=2
289+
ifeq ($(BUILD_TLS),yes)
290+
FINAL_CFLAGS+=-DUSE_OPENSSL=$(BUILD_YES) $(OPENSSL_CFLAGS) -DBUILD_TLS_MODULE=$(BUILD_NO)
291+
FINAL_LDFLAGS+=$(OPENSSL_LDFLAGS)
285292
FINAL_LIBS += ../deps/hiredis/libhiredis_ssl.a $(LIBSSL_LIBS) $(LIBCRYPTO_LIBS)
286293
endif
287294

295+
TLS_MODULE=
296+
TLS_MODULE_NAME:=redis-tls$(PROG_SUFFIX).so
297+
TLS_MODULE_CFLAGS:=$(FINAL_CFLAGS)
298+
ifeq ($(BUILD_TLS),module)
299+
FINAL_CFLAGS+=-DUSE_OPENSSL=$(BUILD_MODULE) $(OPENSSL_CFLAGS)
300+
TLS_CLIENT_LIBS = ../deps/hiredis/libhiredis_ssl.a $(LIBSSL_LIBS) $(LIBCRYPTO_LIBS)
301+
TLS_MODULE=$(TLS_MODULE_NAME)
302+
TLS_MODULE_CFLAGS+=-DUSE_OPENSSL=$(BUILD_MODULE) $(OPENSSL_CFLAGS) -DBUILD_TLS_MODULE=$(BUILD_MODULE)
303+
endif
304+
288305
ifndef V
289306
define MAKE_INSTALL
290307
@printf ' %b %b\n' $(LINKCOLOR)INSTALL$(ENDCOLOR) $(BINCOLOR)$(1)$(ENDCOLOR) 1>&2
@@ -325,7 +342,7 @@ REDIS_CHECK_RDB_NAME=redis-check-rdb$(PROG_SUFFIX)
325342
REDIS_CHECK_AOF_NAME=redis-check-aof$(PROG_SUFFIX)
326343
ALL_SOURCES=$(sort $(patsubst %.o,%.c,$(REDIS_SERVER_OBJ) $(REDIS_CLI_OBJ) $(REDIS_BENCHMARK_OBJ)))
327344

328-
all: $(REDIS_SERVER_NAME) $(REDIS_SENTINEL_NAME) $(REDIS_CLI_NAME) $(REDIS_BENCHMARK_NAME) $(REDIS_CHECK_RDB_NAME) $(REDIS_CHECK_AOF_NAME)
345+
all: $(REDIS_SERVER_NAME) $(REDIS_SENTINEL_NAME) $(REDIS_CLI_NAME) $(REDIS_BENCHMARK_NAME) $(REDIS_CHECK_RDB_NAME) $(REDIS_CHECK_AOF_NAME) $(TLS_MODULE)
329346
@echo ""
330347
@echo "Hint: It's a good idea to run 'make test' ;)"
331348
@echo ""
@@ -385,13 +402,17 @@ $(REDIS_CHECK_RDB_NAME): $(REDIS_SERVER_NAME)
385402
$(REDIS_CHECK_AOF_NAME): $(REDIS_SERVER_NAME)
386403
$(REDIS_INSTALL) $(REDIS_SERVER_NAME) $(REDIS_CHECK_AOF_NAME)
387404

405+
# redis-tls.so
406+
$(TLS_MODULE_NAME): $(REDIS_SERVER_NAME)
407+
$(QUIET_CC)$(CC) -o $@ tls.c -shared -fPIC $(TLS_MODULE_CFLAGS) $(TLS_CLIENT_LIBS)
408+
388409
# redis-cli
389410
$(REDIS_CLI_NAME): $(REDIS_CLI_OBJ)
390-
$(REDIS_LD) -o $@ $^ ../deps/hiredis/libhiredis.a ../deps/linenoise/linenoise.o $(FINAL_LIBS)
411+
$(REDIS_LD) -o $@ $^ ../deps/hiredis/libhiredis.a ../deps/linenoise/linenoise.o $(FINAL_LIBS) $(TLS_CLIENT_LIBS)
391412

392413
# redis-benchmark
393414
$(REDIS_BENCHMARK_NAME): $(REDIS_BENCHMARK_OBJ)
394-
$(REDIS_LD) -o $@ $^ ../deps/hiredis/libhiredis.a ../deps/hdr_histogram/libhdrhistogram.a $(FINAL_LIBS)
415+
$(REDIS_LD) -o $@ $^ ../deps/hiredis/libhiredis.a ../deps/hdr_histogram/libhdrhistogram.a $(FINAL_LIBS) $(TLS_CLIENT_LIBS)
395416

396417
DEP = $(REDIS_SERVER_OBJ:%.o=%.d) $(REDIS_CLI_OBJ:%.o=%.d) $(REDIS_BENCHMARK_OBJ:%.o=%.d)
397418
-include $(DEP)
@@ -410,7 +431,7 @@ commands.c: commands/*.json ../utils/generate-command-code.py
410431
endif
411432

412433
clean:
413-
rm -rf $(REDIS_SERVER_NAME) $(REDIS_SENTINEL_NAME) $(REDIS_CLI_NAME) $(REDIS_BENCHMARK_NAME) $(REDIS_CHECK_RDB_NAME) $(REDIS_CHECK_AOF_NAME) *.o *.gcda *.gcno *.gcov redis.info lcov-html Makefile.dep
434+
rm -rf $(REDIS_SERVER_NAME) $(REDIS_SENTINEL_NAME) $(REDIS_CLI_NAME) $(REDIS_BENCHMARK_NAME) $(REDIS_CHECK_RDB_NAME) $(REDIS_CHECK_AOF_NAME) *.o *.gcda *.gcno *.gcov redis.info lcov-html Makefile.dep *.so
414435
rm -f $(DEP)
415436

416437
.PHONY: clean

src/connection.h

+1-12
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ typedef struct ConnectionType {
107107

108108
/* TLS specified methods */
109109
sds (*get_peer_cert)(struct connection *conn);
110-
void* (*get_ctx)(void);
111-
void* (*get_client_ctx)(void);
112110
} ConnectionType;
113111

114112
struct connection {
@@ -355,15 +353,6 @@ int connKeepAlive(connection *conn, int interval);
355353
int connSendTimeout(connection *conn, long long ms);
356354
int connRecvTimeout(connection *conn, long long ms);
357355

358-
/* Helpers for tls special considerations */
359-
static inline void *connTypeGetCtx(ConnectionType *ct) {
360-
return ct->get_ctx();
361-
}
362-
363-
static inline void *connTypeGetClientCtx(ConnectionType *ct) {
364-
return ct->get_client_ctx();
365-
}
366-
367356
/* Get cert for the secure connection */
368357
static inline sds connGetPeerCert(connection *conn) {
369358
if (conn->type->get_peer_cert) {
@@ -399,7 +388,7 @@ static inline connection *connCreate(ConnectionType *ct) {
399388
return ct->conn_create();
400389
}
401390

402-
/* Create a accepted connection of specified type.
391+
/* Create an accepted connection of specified type.
403392
* priv is connection type specified argument */
404393
static inline connection *connCreateAccepted(ConnectionType *ct, int fd, void *priv) {
405394
return ct->conn_create_accepted(fd, priv);

src/mkreleasehdr.sh

+2
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ test -f release.h || touch release.h
1111
echo "#define REDIS_GIT_SHA1 \"$GIT_SHA1\"" > release.h
1212
echo "#define REDIS_GIT_DIRTY \"$GIT_DIRTY\"" >> release.h
1313
echo "#define REDIS_BUILD_ID \"$BUILD_ID\"" >> release.h
14+
echo "#include \"version.h\"" >> release.h
15+
echo "#define REDIS_BUILD_ID_RAW REDIS_VERSION REDIS_BUILD_ID REDIS_GIT_DIRTY REDIS_GIT_SHA1" >> release.h
1416
touch release.c # Force recompile of release.c

src/module.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@
6969
* pointers that have an API the module can call with them)
7070
* -------------------------------------------------------------------------- */
7171

72-
typedef struct RedisModuleInfoCtx {
72+
struct RedisModuleInfoCtx {
7373
struct RedisModule *module;
7474
dict *requested_sections;
7575
sds info; /* info string we collected so far */
7676
int sections; /* number of sections we collected so far */
7777
int in_section; /* indication if we're in an active section or not */
7878
int in_dict_field; /* indication that we're currently appending to a dict */
79-
} RedisModuleInfoCtx;
79+
};
8080

8181
/* This represents a shared API. Shared APIs will be used to populate
8282
* the server.sharedapi dictionary, mapping names of APIs exported by
@@ -12211,13 +12211,13 @@ const char *RM_GetCurrentCommandName(RedisModuleCtx *ctx) {
1221112211
/* The defrag context, used to manage state during calls to the data type
1221212212
* defrag callback.
1221312213
*/
12214-
typedef struct RedisModuleDefragCtx {
12214+
struct RedisModuleDefragCtx {
1221512215
long defragged;
1221612216
long long int endtime;
1221712217
unsigned long *cursor;
1221812218
struct redisObject *key; /* Optional name of key processed, NULL when unknown. */
1221912219
int dbid; /* The dbid of the key being processed, -1 when unknown. */
12220-
} RedisModuleDefragCtx;
12220+
};
1222112221

1222212222
/* Register a defrag callback for global data, i.e. anything that the module
1222312223
* may allocate that is not tied to a specific data type.

src/redismodule.h

+29-15
Original file line numberDiff line numberDiff line change
@@ -750,13 +750,41 @@ typedef enum {
750750
REDISMODULE_ACL_LOG_CHANNEL /* Channel authorization failure */
751751
} RedisModuleACLLogEntryReason;
752752

753+
/* Incomplete structures needed by both the core and modules. */
754+
typedef struct RedisModuleString RedisModuleString;
755+
typedef struct RedisModuleIO RedisModuleIO;
756+
typedef struct RedisModuleDigest RedisModuleDigest;
757+
typedef struct RedisModuleInfoCtx RedisModuleInfoCtx;
758+
typedef struct RedisModuleDefragCtx RedisModuleDefragCtx;
759+
760+
/* Function pointers needed by both the core and modules, these needs to be
761+
* exposed since you can't cast a function pointer to (void *). */
762+
typedef void (*RedisModuleInfoFunc)(RedisModuleInfoCtx *ctx, int for_crash_report);
763+
typedef void (*RedisModuleDefragFunc)(RedisModuleDefragCtx *ctx);
764+
typedef void (*RedisModuleUserChangedFunc) (uint64_t client_id, void *privdata);
765+
753766
/* ------------------------- End of common defines ------------------------ */
754767

755-
#ifndef REDISMODULE_CORE
768+
#if defined REDISMODULE_CORE
769+
/* Things only defined for the modules core (server), not exported to modules
770+
* that include this file. */
771+
772+
#define RedisModuleString robj
773+
774+
#endif /* defined REDISMODULE_CORE */
775+
776+
#if !defined REDISMODULE_CORE && !defined REDISMODULE_CORE_MODULE
777+
/* Things defined for modules, but not for core-modules. */
756778

757779
typedef long long mstime_t;
758780
typedef long long ustime_t;
759781

782+
#endif /* !defined REDISMODULE_CORE && !defined REDISMODULE_CORE_MODULE */
783+
784+
/* ----------- The rest of the defines are only for modules ----------------- */
785+
#if !defined REDISMODULE_CORE || defined REDISMODULE_CORE_MODULE
786+
/* Things defined for modules and core-modules. */
787+
760788
/* Macro definitions specific to individual compilers */
761789
#ifndef REDISMODULE_ATTR_UNUSED
762790
# ifdef __GNUC__
@@ -786,21 +814,16 @@ typedef long long ustime_t;
786814
typedef struct RedisModuleCtx RedisModuleCtx;
787815
typedef struct RedisModuleCommand RedisModuleCommand;
788816
typedef struct RedisModuleKey RedisModuleKey;
789-
typedef struct RedisModuleString RedisModuleString;
790817
typedef struct RedisModuleCallReply RedisModuleCallReply;
791-
typedef struct RedisModuleIO RedisModuleIO;
792818
typedef struct RedisModuleType RedisModuleType;
793-
typedef struct RedisModuleDigest RedisModuleDigest;
794819
typedef struct RedisModuleBlockedClient RedisModuleBlockedClient;
795820
typedef struct RedisModuleClusterInfo RedisModuleClusterInfo;
796821
typedef struct RedisModuleDict RedisModuleDict;
797822
typedef struct RedisModuleDictIter RedisModuleDictIter;
798823
typedef struct RedisModuleCommandFilterCtx RedisModuleCommandFilterCtx;
799824
typedef struct RedisModuleCommandFilter RedisModuleCommandFilter;
800-
typedef struct RedisModuleInfoCtx RedisModuleInfoCtx;
801825
typedef struct RedisModuleServerInfoData RedisModuleServerInfoData;
802826
typedef struct RedisModuleScanCursor RedisModuleScanCursor;
803-
typedef struct RedisModuleDefragCtx RedisModuleDefragCtx;
804827
typedef struct RedisModuleUser RedisModuleUser;
805828
typedef struct RedisModuleKeyOptCtx RedisModuleKeyOptCtx;
806829

@@ -827,11 +850,8 @@ typedef void (*RedisModuleClusterMessageReceiver)(RedisModuleCtx *ctx, const cha
827850
typedef void (*RedisModuleTimerProc)(RedisModuleCtx *ctx, void *data);
828851
typedef void (*RedisModuleCommandFilterFunc) (RedisModuleCommandFilterCtx *filter);
829852
typedef void (*RedisModuleForkDoneHandler) (int exitcode, int bysignal, void *user_data);
830-
typedef void (*RedisModuleInfoFunc)(RedisModuleInfoCtx *ctx, int for_crash_report);
831853
typedef void (*RedisModuleScanCB)(RedisModuleCtx *ctx, RedisModuleString *keyname, RedisModuleKey *key, void *privdata);
832854
typedef void (*RedisModuleScanKeyCB)(RedisModuleKey *key, RedisModuleString *field, RedisModuleString *value, void *privdata);
833-
typedef void (*RedisModuleUserChangedFunc) (uint64_t client_id, void *privdata);
834-
typedef int (*RedisModuleDefragFunc)(RedisModuleDefragCtx *ctx);
835855
typedef RedisModuleString * (*RedisModuleConfigGetStringFunc)(const char *name, void *privdata);
836856
typedef long long (*RedisModuleConfigGetNumericFunc)(const char *name, void *privdata);
837857
typedef int (*RedisModuleConfigGetBoolFunc)(const char *name, void *privdata);
@@ -1559,11 +1579,5 @@ static int RedisModule_Init(RedisModuleCtx *ctx, const char *name, int ver, int
15591579

15601580
#define RMAPI_FUNC_SUPPORTED(func) (func != NULL)
15611581

1562-
#else
1563-
1564-
/* Things only defined for the modules core, not exported to modules
1565-
* including this file. */
1566-
#define RedisModuleString robj
1567-
15681582
#endif /* REDISMODULE_CORE */
15691583
#endif /* REDISMODULE_H */

src/release.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#include <stdio.h>
3636

3737
#include "release.h"
38-
#include "version.h"
3938
#include "crc64.h"
4039

4140
char *redisGitSHA1(void) {
@@ -46,8 +45,12 @@ char *redisGitDirty(void) {
4645
return REDIS_GIT_DIRTY;
4746
}
4847

48+
const char *redisBuildIdRaw(void) {
49+
return REDIS_BUILD_ID_RAW;
50+
}
51+
4952
uint64_t redisBuildId(void) {
50-
char *buildid = REDIS_VERSION REDIS_BUILD_ID REDIS_GIT_DIRTY REDIS_GIT_SHA1;
53+
char *buildid = REDIS_BUILD_ID_RAW;
5154

5255
return crc64(0,(unsigned char*)buildid,strlen(buildid));
5356
}

0 commit comments

Comments
 (0)