Disable SSL by default

This commit is contained in:
Mark Nunberg 2018-01-08 16:07:10 -05:00
parent 08efa46599
commit 82549a53de
3 changed files with 20 additions and 11 deletions

View File

@ -54,9 +54,11 @@ DYLIB_MAKE_CMD=$(CC) -shared -Wl,-soname,$(DYLIB_MINOR_NAME) -o $(DYLIBNAME) $(L
STLIBNAME=$(LIBNAME).$(STLIBSUFFIX) STLIBNAME=$(LIBNAME).$(STLIBSUFFIX)
STLIB_MAKE_CMD=$(AR) rcs $(STLIBNAME) STLIB_MAKE_CMD=$(AR) rcs $(STLIBNAME)
OPENSSL_PREFIX=/usr/local/opt/openssl ifdef USE_SSL
CFLAGS+=-I$(OPENSSL_PREFIX)/include OPENSSL_PREFIX=/usr/local/opt/openssl
LDFLAGS+=-L$(OPENSSL_PREFIX)/lib -lssl -lcrypto CFLAGS+=-I$(OPENSSL_PREFIX)/include -DHIREDIS_SSL
LDFLAGS+=-L$(OPENSSL_PREFIX)/lib -lssl -lcrypto
endif
# Platform-specific overrides # Platform-specific overrides
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')

View File

@ -2,7 +2,7 @@
#include "sslio.h" #include "sslio.h"
#include <assert.h> #include <assert.h>
#ifndef HIREDIS_NOSSL #ifdef HIREDIS_SSL
#include <pthread.h> #include <pthread.h>
void __redisSetError(redisContext *c, int type, const char *str); void __redisSetError(redisContext *c, int type, const char *str);

21
sslio.h
View File

@ -2,19 +2,26 @@
#define REDIS_SSLIO_H #define REDIS_SSLIO_H
#ifdef HIREDIS_NOSSL #ifndef HIREDIS_SSL
typedef struct redisSsl { typedef struct redisSsl {
int dummy; size_t lastLen;
int wantRead;
int pendingWrite;
} redisSsl; } redisSsl;
static void redisFreeSsl(redisSsl *) { static inline void redisFreeSsl(redisSsl *ssl) {
(void)ssl;
} }
static int redisSslCreate(struct redisContext *c) { static inline int redisSslCreate(struct redisContext *c, const char *ca,
const char *cert, const char *key) {
(void)c;(void)ca;(void)cert;(void)key;
return REDIS_ERR; return REDIS_ERR;
} }
static int redisSslRead(struct redisContect *c, char *s, size_t, n) { static inline int redisSslRead(struct redisContext *c, char *s, size_t n) {
(void)c;(void)s;(void)n;
return -1; return -1;
} }
static int redisSslWrite(struct redisContext *c) { static inline int redisSslWrite(struct redisContext *c) {
(void)c;
return -1; return -1;
} }
#else #else
@ -53,5 +60,5 @@ int redisSslCreate(struct redisContext *c, const char *caPath,
int redisSslRead(struct redisContext *c, char *buf, size_t bufcap); int redisSslRead(struct redisContext *c, char *buf, size_t bufcap);
int redisSslWrite(struct redisContext *c); int redisSslWrite(struct redisContext *c);
#endif /* !HIREDIS_NOSSL */ #endif /* HIREDIS_SSL */
#endif /* HIREDIS_SSLIO_H */ #endif /* HIREDIS_SSLIO_H */